[Zodb-checkins] SVN: ZODB/branches/3.9/src/ merged ZODB/branches/tseaver-squelch_2.6_warnings to avoid a warning

Jim Fulton jim at zope.com
Mon Apr 18 11:05:10 EDT 2011


Log message for revision 121442:
  merged ZODB/branches/tseaver-squelch_2.6_warnings to avoid a warning
  while running tests.
  

Changed:
  U   ZODB/branches/3.9/src/BTrees/tests/test_compare.py
  U   ZODB/branches/3.9/src/ZEO/tests/zeoserver.py

-=-
Modified: ZODB/branches/3.9/src/BTrees/tests/test_compare.py
===================================================================
--- ZODB/branches/3.9/src/BTrees/tests/test_compare.py	2011-04-18 14:59:10 UTC (rev 121441)
+++ ZODB/branches/3.9/src/BTrees/tests/test_compare.py	2011-04-18 15:05:09 UTC (rev 121442)
@@ -47,8 +47,19 @@
         self.assertRaises(UnicodeError, callable, *args)
 
     def testBucketGet(self):
-        self.bucket[self.s] = 1
-        self.assertUE(self.bucket.get, self.u)
+        import sys
+        import warnings
+        _warnlog = []
+        def _showwarning(*args, **kw):
+            _warnlog.append((args, kw))
+        warnings.showwarning, _before = _showwarning, warnings.showwarning
+        try:
+            self.bucket[self.s] = 1
+            self.assertUE(self.bucket.get, self.u)
+        finally:
+            warnings.showwarning = _before
+        if sys.version_info >= (2, 6):
+            self.assertEqual(len(_warnlog), 1)
 
     def testSetGet(self):
         self.set.insert(self.s)

Modified: ZODB/branches/3.9/src/ZEO/tests/zeoserver.py
===================================================================
--- ZODB/branches/3.9/src/ZEO/tests/zeoserver.py	2011-04-18 14:59:10 UTC (rev 121441)
+++ ZODB/branches/3.9/src/ZEO/tests/zeoserver.py	2011-04-18 15:05:09 UTC (rev 121442)
@@ -207,4 +207,6 @@
 
 
 if __name__ == '__main__':
+    import warnings
+    warnings.simplefilter('ignore')
     main()



More information about the Zodb-checkins mailing list