[Zope-Checkins] CVS: ZODB3/ZConfig/tests - test_loader.py:1.14.44.2

Jeremy Hylton jeremy at zope.com
Mon Sep 15 14:03:31 EDT 2003


Update of /cvs-repository/ZODB3/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv13599/ZConfig/tests

Modified Files:
      Tag: Zope-2_7-branch
	test_loader.py 
Log Message:
Take two: Merge changes from ZODB3-3_2-branch to Zope-2_7-branch.

Please make all future changes on the Zope-2_7-branch instead.

The previous attempt used "cvs up -j ZODB3-3_2-branch", but appeared
to get only a small fraction of the changes.  This attempt is based on
copying a checkout of ZODB3-3_2-branch over top of a checkout of
Zope-2_7-branch.


=== ZODB3/ZConfig/tests/test_loader.py 1.14.44.1 => 1.14.44.2 ===
--- ZODB3/ZConfig/tests/test_loader.py:1.14.44.1	Mon Jul 21 12:37:02 2003
+++ ZODB3/ZConfig/tests/test_loader.py	Mon Sep 15 14:03:00 2003
@@ -76,30 +76,22 @@
         schema = loader.loadFile(sio)
         self.assert_(schema.gettype("widget-a") is not None)
 
-    def test_import_from_package_with_file(self):
+    def test_import_from_package_extended(self):
         loader = ZConfig.loader.SchemaLoader()
         sio = StringIO("<schema>"
-                       "  <import package='ZConfig.tests.library.widget'"
-                       "          file='extra.xml' />"
+                       "  <import package='ZConfig.tests.library.thing'/>"
+                       "  <section name='*' type='thing' attribute='thing'/>"
                        "</schema>")
         schema = loader.loadFile(sio)
-        self.assert_(schema.gettype("extra-type") is not None)
+        schema.gettype("thing")
+        schema.gettype("thing-a")
+        schema.gettype("thing-b")
+        schema.gettype("thing-ext")
 
-    def test_import_from_package_with_missing_file(self):
-        loader = ZConfig.loader.SchemaLoader()
-        sio = StringIO("<schema>"
-                       "  <import package='ZConfig.tests.library.widget'"
-                       "          file='notthere.xml' />"
-                       "</schema>")
-        self.assertRaises(ZConfig.SchemaError, loader.loadFile, sio)
-
-    def test_import_from_package_with_directory_file(self):
-        loader = ZConfig.loader.SchemaLoader()
-        sio = StringIO("<schema>"
-                       "  <import package='ZConfig.tests.library.widget'"
-                       "          file='really/notthere.xml' />"
-                       "</schema>")
-        self.assertRaises(ZConfig.SchemaError, loader.loadFile, sio)
+        # Make sure the extension is wired in properly:
+        sio = StringIO("<thing-ext thing/>")
+        conf, handlers = ZConfig.loadConfigFile(schema, sio)
+        self.assertEqual(conf.thing.thing_ext_key, "thing-ext-default")
 
     def test_urlsplit_urlunsplit(self):
         # Extracted from Python's test.test_urlparse module:




More information about the Zope-Checkins mailing list