[Zodb-checkins] CVS: Zope/lib/python/ZConfig/tests - test_loader.py:1.21

Fred Drake cvs-admin at zope.org
Wed Oct 22 17:32:17 EDT 2003


Update of /cvs-repository/Zope/lib/python/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv25549/tests

Modified Files:
	test_loader.py 
Log Message:
Repeated imports failed; fixed and added tests.


=== Zope/lib/python/ZConfig/tests/test_loader.py 1.20 => 1.21 ===
--- Zope/lib/python/ZConfig/tests/test_loader.py:1.20	Fri Oct  3 17:43:59 2003
+++ Zope/lib/python/ZConfig/tests/test_loader.py	Wed Oct 22 17:32:16 2003
@@ -133,6 +133,31 @@
         schema.gettype("widget-a")
         schema.gettype("extra-type")
 
+    def test_import_component_twice_1(self):
+        # Make sure we can import a component twice from a schema.
+        # This is most likely to occur when the component is imported
+        # from each of two other components, or from the top-level
+        # schema and a component.
+        loader = ZConfig.loader.SchemaLoader()
+        sio = StringIO("<schema>"
+                       "  <import package='ZConfig.tests.library.widget' />"
+                       "  <import package='ZConfig.tests.library.widget' />"
+                       "</schema>")
+        schema = loader.loadFile(sio)
+        schema.gettype("widget-a")
+
+    def test_import_component_twice_2(self):
+        # Make sure we can import a component from a config file even
+        # if it has already been imported from the schema.
+        loader = ZConfig.loader.SchemaLoader()
+        sio = StringIO("<schema>"
+                       "  <import package='ZConfig.tests.library.widget' />"
+                       "</schema>")
+        schema = loader.loadFile(sio)
+        loader = ZConfig.loader.ConfigLoader(schema)
+        sio = StringIO("%import ZConfig.tests.library.widget")
+        loader.loadFile(sio)
+
     def test_urlsplit_urlunsplit(self):
         # Extracted from Python's test.test_urlparse module:
         for url, parsed, split in [




More information about the Zodb-checkins mailing list