[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Merged from jim-adapter branch:

Jim Fulton jim at zope.com
Fri Apr 7 08:08:53 EDT 2006


Log message for revision 66637:
  Merged from jim-adapter branch:
  
  Log message for revision 66634:
    Fixed the way deprecations were temporarily disabled so that
    they are disabled truly temporarily. :)
  

Changed:
  U   Zope3/trunk/src/zope/app/component/tests/test_directives.py
  U   Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py
  U   Zope3/trunk/src/zope/app/schema/tests/test_directives.py
  U   Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py

-=-
Modified: Zope3/trunk/src/zope/app/component/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/component/tests/test_directives.py	2006-04-07 12:08:49 UTC (rev 66636)
+++ Zope3/trunk/src/zope/app/component/tests/test_directives.py	2006-04-07 12:08:52 UTC (rev 66637)
@@ -1369,9 +1369,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 % (
@@ -1386,7 +1386,7 @@
         from factory import X
         self.assertEqual(zapi.createObject('foo.bar').__class__, X)
 
-        warnings.resetwarnings()
+        warnings.showwarning = showwarning
 
 class ParticipationStub(object):
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py	2006-04-07 12:08:49 UTC (rev 66636)
+++ Zope3/trunk/src/zope/app/publisher/browser/metaconfigure.py	2006-04-07 12:08:52 UTC (rev 66637)
@@ -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/trunk/src/zope/app/schema/tests/test_directives.py
===================================================================
--- Zope3/trunk/src/zope/app/schema/tests/test_directives.py	2006-04-07 12:08:49 UTC (rev 66636)
+++ Zope3/trunk/src/zope/app/schema/tests/test_directives.py	2006-04-07 12:08:52 UTC (rev 66637)
@@ -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/trunk/src/zope/modulealias/tests/test_modulealias.py
===================================================================
--- Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py	2006-04-07 12:08:49 UTC (rev 66636)
+++ Zope3/trunk/src/zope/modulealias/tests/test_modulealias.py	2006-04-07 12:08:52 UTC (rev 66637)
@@ -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