[Zope3-checkins] CVS: Zope/lib/python/ZConfig/tests - test_loader.py:1.14.44.1
Chris McDonough
chrism@zope.com
Mon, 21 Jul 2003 12:39:07 -0400
Update of /cvs-repository/Zope/lib/python/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv17213/lib/python/ZConfig/tests
Modified Files:
Tag: Zope-2_7-branch
test_loader.py
Log Message:
Merge changes from HEAD since the release of Zope 2.7a1 into the Zope-2_7-branch in preparation for release of Zope 2.7b1.
=== Zope/lib/python/ZConfig/tests/test_loader.py 1.14 => 1.14.44.1 ===
--- Zope/lib/python/ZConfig/tests/test_loader.py:1.14 Wed Feb 19 10:54:15 2003
+++ Zope/lib/python/ZConfig/tests/test_loader.py Mon Jul 21 12:37:02 2003
@@ -76,22 +76,30 @@
schema = loader.loadFile(sio)
self.assert_(schema.gettype("widget-a") is not None)
- def test_import_from_package_extended(self):
+ def test_import_from_package_with_file(self):
loader = ZConfig.loader.SchemaLoader()
sio = StringIO("<schema>"
- " <import package='ZConfig.tests.library.thing'/>"
- " <section name='*' type='thing' attribute='thing'/>"
+ " <import package='ZConfig.tests.library.widget'"
+ " file='extra.xml' />"
"</schema>")
schema = loader.loadFile(sio)
- schema.gettype("thing")
- schema.gettype("thing-a")
- schema.gettype("thing-b")
- schema.gettype("thing-ext")
+ self.assert_(schema.gettype("extra-type") is not None)
- # 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_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)
def test_urlsplit_urlunsplit(self):
# Extracted from Python's test.test_urlparse module: