[Checkins] SVN: Zope3/trunk/src/ Merge philikon-reduce-zcml branch: Implementation of

Jim Fulton jim at zope.com
Thu Apr 6 22:00:54 EDT 2006


Philipp von Weitershausen wrote:
 > Modified: Zope3/trunk/src/zope/app/component/tests/test_directives.py
 > ===================================================================
 > --- Zope3/trunk/src/zope/app/component/tests/test_directives.py	2006-03-19 10:54:17 UTC (rev 66067)
 > +++ Zope3/trunk/src/zope/app/component/tests/test_directives.py	2006-03-19 16:27:42 UTC (rev 66068)
 > @@ -18,6 +18,7 @@
 >  import re
 >  import unittest
 >  import pprint
 > +import warnings
 >  from cStringIO import StringIO
 >
 >  from zope.interface import Interface, implements
 > @@ -1366,8 +1367,11 @@
 >              ))
 >          self.assertRaises(ValueError, xmlconfig, config, testing=1)
 >
 > +    # BBB 2006/02/24, to be removed after 12 months
 >      def testFactory(self):
 > -
 > +        def ignorewarning(message, category, filename, lineno, file=None):
 > +            pass
 > +        warnings.showwarning = ignorewarning
 >          self.assertRaises(ComponentLookupError, zapi.createObject, 'foo')
 >
 >          xmlconfig(StringIO(template % (
 > @@ -1382,6 +1386,7 @@
 >          from factory import X
 >          self.assertEqual(zapi.createObject('foo.bar').__class__, X)
 >
 > +        warnings.resetwarnings()

This change effectively disabled warnings for subsequent tests, which, of course,
is bad.

I would not expect resetwarnings() to restore a replaced module
function.  A better solution would be to simply save the old value of
showwarning and restore it.

Jim






More information about the Checkins mailing list