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

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


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

Modified Files:
      Tag: Zope-2_7-branch
	test_loader.py 
Log Message:
Repeated imports failed; fixed and added tests.


=== Zope/lib/python/ZConfig/tests/test_loader.py 1.14.44.4 => 1.14.44.5 ===
--- Zope/lib/python/ZConfig/tests/test_loader.py:1.14.44.4	Tue Oct  7 15:36:24 2003
+++ Zope/lib/python/ZConfig/tests/test_loader.py	Wed Oct 22 17:39:18 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