[Zope3-checkins] Re: [Checkins] SVN: Zope3/trunk/src/ Merge
philikon-reduce-zcml branch: Implementation of
Jim Fulton
jim at zope.com
Fri Apr 7 06:36:43 EDT 2006
Jim Fulton wrote:
> 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.
I'm going to go ahead and change all of the places where this was done.
JIm
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-Checkins
mailing list