[Checkins] SVN: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/ z.c.xmlconfig.ConfigurationHandler.testing should be a bool, not an int.

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


Log message for revision 125824:
  z.c.xmlconfig.ConfigurationHandler.testing should be a bool, not an int.

Changed:
  U   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py
  U   zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/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 11:42:17 UTC (rev 125823)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/tests/test_xmlconfig.py	2012-05-10 23:25:58 UTC (rev 125824)
@@ -116,6 +116,20 @@
     def _makeOne(self, *args, **kw):
         return self._getTargetClass()(*args, **kw)
 
+    def test_ctor_defaults(self):
+        context = object()
+        ch = self._makeOne(context)
+        self.assertTrue(ch.context is context)
+        self.assertFalse(ch.testing)
+        self.assertEqual(ch.ignore_depth, 0)
+
+    def test_ctor_explicit(self):
+        context = object()
+        ch = self._makeOne(context, True)
+        self.assertTrue(ch.context is context)
+        self.assertTrue(ch.testing)
+        self.assertEqual(ch.ignore_depth, 0)
+
     def test_normal(self):
         context = FauxContext()
         locator = FauxLocator('tests//sample.zcml', 1, 1)

Modified: zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/xmlconfig.py
===================================================================
--- zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/xmlconfig.py	2012-05-10 11:42:17 UTC (rev 125823)
+++ zope.configuration/branches/tseaver-test_cleanup/src/zope/configuration/xmlconfig.py	2012-05-10 23:25:58 UTC (rev 125824)
@@ -159,7 +159,7 @@
     Translate parser events into calls into the configuration system.
     """
 
-    def __init__(self, context, testing=0):
+    def __init__(self, context, testing=False):
         self.context = context
         self.testing = testing
         self.ignore_depth = 0



More information about the checkins mailing list