[Zodb-checkins] CVS: Packages/SFTPGateway/src/ZConfig/tests -
test_loader.py:1.22
Fred L. Drake, Jr.
fred at zope.com
Sun Dec 28 20:27:44 EST 2003
Update of /cvs-repository/Packages/SFTPGateway/src/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv29484
Modified Files:
test_loader.py
Log Message:
test initialization of the new SchemaResourceError exception
=== Packages/SFTPGateway/src/ZConfig/tests/test_loader.py 1.21 => 1.22 ===
--- Packages/SFTPGateway/src/ZConfig/tests/test_loader.py:1.21 Wed Oct 22 17:32:16 2003
+++ Packages/SFTPGateway/src/ZConfig/tests/test_loader.py Sun Dec 28 20:27:28 2003
@@ -77,8 +77,16 @@
sio = StringIO("<schema>"
" <import package='ZConfig.tests.test_loader'/>"
"</schema>")
- self.assertRaises(ZConfig.SchemaError, ZConfig.loadSchemaFile,
- sio)
+ try:
+ ZConfig.loadSchemaFile(sio)
+ except ZConfig.SchemaResourceError, e:
+ self.assertEqual(e.filename, "component.xml")
+ self.assertEqual(e.package, "ZConfig.tests.test_loader")
+ self.assert_(e.path is None)
+ # make sure the str() doesn't raise an unexpected exception
+ str(e)
+ else:
+ self.fail("expected SchemaResourceError")
def test_import_from_package(self):
loader = ZConfig.loader.SchemaLoader()
@@ -112,7 +120,16 @@
" <import package='ZConfig.tests.library.widget'"
" file='notthere.xml' />"
"</schema>")
- self.assertRaises(ZConfig.SchemaError, loader.loadFile, sio)
+ try:
+ loader.loadFile(sio)
+ except ZConfig.SchemaResourceError, e:
+ self.assertEqual(e.filename, "notthere.xml")
+ self.assertEqual(e.package, "ZConfig.tests.library.widget")
+ self.assert_(e.path)
+ # make sure the str() doesn't raise an unexpected exception
+ str(e)
+ else:
+ self.fail("expected SchemaResourceError")
def test_import_from_package_with_directory_file(self):
loader = ZConfig.loader.SchemaLoader()
More information about the Zodb-checkins
mailing list