[Zope3-checkins] CVS: Zope3/src/zope/configuration/tests - test_xml.py:1.7
Fred L. Drake, Jr.
fred@zope.com
Mon, 23 Jun 2003 10:44:44 -0400
Update of /cvs-repository/Zope3/src/zope/configuration/tests
In directory cvs.zope.org:/tmp/cvs-serv23423/tests
Modified Files:
test_xml.py
Log Message:
When loading a file, if it does not exist but a file with the same name and
a .in suffix does, load the .in version instead of raising an error.
Added tests.
=== Zope3/src/zope/configuration/tests/test_xml.py 1.6 => 1.7 ===
--- Zope3/src/zope/configuration/tests/test_xml.py:1.6 Mon Jun 23 10:27:57 2003
+++ Zope3/src/zope/configuration/tests/test_xml.py Mon Jun 23 10:44:13 2003
@@ -28,8 +28,8 @@
# this actually becomes the remove() method
from os import remove
- def __init__(self):
- self.file = open(tempfile.mktemp(), 'w')
+ def __init__(self, suffix=''):
+ self.file = open(tempfile.mktemp(suffix), 'w')
self.closed = 0
def write(self,buffer):
self.file.write(buffer)
@@ -72,6 +72,30 @@
package="zope.configuration.tests.*"
file="contact.zcml" />
</zopeConfigure>""")
+
+ def testIncludeIn(self):
+ self.checkZCMLText(
+ """<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+ <include
+ package="zope.configuration.tests.contact"
+ file="alternate.zcml" />
+ </zopeConfigure>""")
+
+ def testToplevelIn(self):
+ file = TempFile('.in')
+ name = file.name
+ assert name.endswith('.in')
+ file.write(
+ """<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+ <include
+ package="zope.configuration.tests.contact"
+ file="contact.zcml" />
+ </zopeConfigure>""")
+ file.flush()
+ from zope.configuration.xmlconfig import XMLConfig
+ x = XMLConfig(name[:-3])
+ x()
+ file.close()
def testIncludeNoSiteManagementFolder(self):
file = TempFile()