[Checkins] SVN: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py Full coverage for z.c.xmlconfig.processxmlfile.

Tres Seaver cvs-admin at zope.org
Thu May 10 23:26:12 UTC 2012


Log message for revision 125826:
  Full coverage for z.c.xmlconfig.processxmlfile.

Changed:
  U   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py

-=-
Modified: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py	2012-05-10 23:26:03 UTC (rev 125825)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py	2012-05-10 23:26:09 UTC (rev 125826)
@@ -382,15 +382,27 @@
         self.assertTrue(context._end_called)
 
 
-class Test_processxmlfile(unittest.TestCase):
+class Test_processxmlfile(_Catchable, unittest.TestCase):
 
     def _callFUT(self, *args, **kw):
         from zope.configuration.xmlconfig import processxmlfile
         return processxmlfile(*args, **kw)
 
-    def test_it(self):
+    def test_w_empty_xml(self):
+        from StringIO import StringIO
         from zope.configuration.config import ConfigurationMachine
         from zope.configuration.xmlconfig import registerCommonDirectives
+        from zope.configuration.xmlconfig import ZopeSAXParseException
+        context = ConfigurationMachine()
+        registerCommonDirectives(context)
+        exc = self.assertRaises(ZopeSAXParseException,
+                                self._callFUT, StringIO(), context)
+        self.assertEqual(str(exc._v), '<string>:1:0: no element found')
+
+    def test_w_valid_xml_fp(self):
+        # Integration test, really
+        from zope.configuration.config import ConfigurationMachine
+        from zope.configuration.xmlconfig import registerCommonDirectives
         from zope.configuration._compat import b
         from zope.configuration.tests.samplepackage import foo
         file = open(path("samplepackage", "configure.zcml"))



More information about the checkins mailing list