[Zope-Checkins] CVS: Zope3/lib/python/Zope/Configuration/tests - testDirectivesXML.py:1.1.2.6 testXML.py:1.1.2.11

Casey Duncan casey@zope.com
Wed, 3 Apr 2002 15:44:11 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Configuration/tests
In directory cvs.zope.org:/tmp/cvs-serv365/lib/python/Zope/Configuration/tests

Modified Files:
      Tag: Zope-3x-branch
	testDirectivesXML.py testXML.py 
Log Message:
Zope configuration now uses Shane's nifty traceback supplements to sprinkle
helpful debug info into exceptions that occur during configuration processing,
rather than masking them with a single generic configuration exception. 

Exception formatting is now turned on during testing, and when config is run
at startup.


=== Zope3/lib/python/Zope/Configuration/tests/testDirectivesXML.py 1.1.2.5 => 1.1.2.6 ===
 from cStringIO import StringIO
 from Zope.Configuration.xmlconfig import xmlconfig, ZopeXMLConfigurationError
+from Zope.Configuration.meta import InvalidDirective
 from Zope.Configuration.tests.Directives import protections, done
 from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
 
@@ -81,7 +82,7 @@
     def testBadNoPrefixComplexDirective(self):
 
         self.assertRaises(
-            ZopeXMLConfigurationError,
+            InvalidDirective,
             xmlconfig,
             StringIO(
             template % (
@@ -115,11 +116,8 @@
                 <test2:protect permission="edit" methods='update' />
                 </test:protectClass>'''
                 )))
-        except ZopeXMLConfigurationError, v:
-            self.assertEqual(
-                str(v),
-                "\nInvalidDirective: (None, u'test2:protect')\nat line 11 "
-                "column 16 of <string>")
+        except InvalidDirective, v:
+            self.assertEqual(str(v), "(None, u'test2:protect')")
         else:
             self.fail('Should have raised ZopeXMLConfigurationError')
         


=== Zope3/lib/python/Zope/Configuration/tests/testXML.py 1.1.2.10 => 1.1.2.11 ===
 from cStringIO import StringIO
 from Zope.Configuration.xmlconfig import xmlconfig, ZopeXMLConfigurationError
+from Zope.Configuration.meta import InvalidDirective, BrokenDirective
 from Zope.Configuration.tests.Directives import protections, done
 from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
 
@@ -77,7 +78,7 @@
     def testBadNoPrefixComplexDirective(self):
 
         self.assertRaises(
-            ZopeXMLConfigurationError,
+            InvalidDirective,
             xmlconfig,
             StringIO(
             template % (
@@ -109,11 +110,8 @@
                 <test2:protect permission="edit" methods='update' />
                 </test:protectClass>'''
                 )))
-        except ZopeXMLConfigurationError, v:
-            self.assertEqual(
-                str(v),
-                "\nInvalidDirective: (None, u'test2:protect')\nat line 10 "
-                "column 16 of <string>")
+        except InvalidDirective, v:
+            self.assertEqual(str(v), "(None, u'test2:protect')")
         else:
             self.fail('Should have raised ZopeXMLConfigurationError')