[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/ Fixed
the way deprecations were temporarily disabled so that
Jim Fulton
jim at zope.com
Fri Apr 7 07:18:07 EDT 2006
Log message for revision 66634:
Fixed the way deprecations were temporarily disabled so that
they are disabled truly temporarily. :)
Changed:
U Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py
U Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py
U Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_directives.py
U Zope3/branches/jim-adapter/src/zope/modulealias/tests/test_modulealias.py
-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py 2006-04-07 11:13:18 UTC (rev 66633)
+++ Zope3/branches/jim-adapter/src/zope/app/component/tests/test_directives.py 2006-04-07 11:18:06 UTC (rev 66634)
@@ -1363,9 +1363,9 @@
# 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
+ showwarning = warnings.showwarning
+ warnings.showwarning = lambda *a, **k: None
+
self.assertRaises(ComponentLookupError, zapi.createObject, 'foo')
xmlconfig(StringIO(template % (
@@ -1380,7 +1380,7 @@
from factory import X
self.assertEqual(zapi.createObject('foo.bar').__class__, X)
- warnings.resetwarnings()
+ warnings.showwarning = showwarning
class ParticipationStub(object):
Modified: Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py 2006-04-07 11:13:18 UTC (rev 66633)
+++ Zope3/branches/jim-adapter/src/zope/app/publisher/browser/metaconfigure.py 2006-04-07 11:18:06 UTC (rev 66634)
@@ -45,8 +45,10 @@
"""Provides a new layer.
First, let's ignore the warnigns:
- >>> warnings.filterwarnings('ignore', category=DeprecationWarning)
+ >>> showwarning = warnings.showwarning
+ >>> warnings.showwarning = lambda *a, **k: None
+
>>> class Info(object):
... file = u'doctest'
... line = 1
@@ -137,7 +139,8 @@
ConfigurationError: You cannot specify the 'interface' and 'base' together.
Enabling the warnings again:
- >>> warnings.resetwarnings()
+
+ >>> warnings.showwarning = showwarning
"""
if name is not None and ',' in name:
raise TypeError("Commas are not allowed in layer names.")
Modified: Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_directives.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_directives.py 2006-04-07 11:13:18 UTC (rev 66633)
+++ Zope3/branches/jim-adapter/src/zope/app/schema/tests/test_directives.py 2006-04-07 11:18:06 UTC (rev 66634)
@@ -40,13 +40,12 @@
def setUp(self):
super(DirectivesTest, self).setUp()
- def ignorewarning(message, category, filename, lineno, file=None):
- pass
- warnings.showwarning = ignorewarning
+ self.__showwarning = warnings.showwarning
+ warnings.showwarning = lambda *a, **k: None
def tearDown(self):
+ warnings.showwarning = self.__showwarning
super(DirectivesTest, self).tearDown()
- warnings.resetwarnings()
def check_vocabulary_get(self, kw={}):
context = object()
Modified: Zope3/branches/jim-adapter/src/zope/modulealias/tests/test_modulealias.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/modulealias/tests/test_modulealias.py 2006-04-07 11:13:18 UTC (rev 66633)
+++ Zope3/branches/jim-adapter/src/zope/modulealias/tests/test_modulealias.py 2006-04-07 11:18:06 UTC (rev 66634)
@@ -41,19 +41,16 @@
def setUp(self):
self.keys = sys.modules.keys()
+ self.__showwarning = warnings.showwarning
+ warnings.showwarning = lambda *a, **k: None
- def ignorewarning(message, category, filename, lineno, file=None):
- pass
- warnings.showwarning = ignorewarning
-
def tearDown(self):
+ warnings.showwarning = self.__showwarning
keys = sys.modules.keys()
for key in keys:
if key not in self.keys:
del sys.modules[key]
- warnings.resetwarnings()
-
def test_definemodulealias(self):
context = ConfigurationContext()
from zope.modulealias.metaconfigure import alias_module
More information about the Zope3-Checkins
mailing list