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

Jim Fulton jim at zope.com
Mon Apr 11 17:01:44 EDT 2011


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

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

-=-
Modified: ZODB/trunk/src/BTrees/tests/test_compare.py
===================================================================
--- ZODB/trunk/src/BTrees/tests/test_compare.py	2011-04-11 21:01:43 UTC (rev 121388)
+++ ZODB/trunk/src/BTrees/tests/test_compare.py	2011-04-11 21:01:44 UTC (rev 121389)
@@ -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/trunk/src/ZEO/tests/zeoserver.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/zeoserver.py	2011-04-11 21:01:43 UTC (rev 121388)
+++ ZODB/trunk/src/ZEO/tests/zeoserver.py	2011-04-11 21:01:44 UTC (rev 121389)
@@ -210,4 +210,6 @@
 
 
 if __name__ == '__main__':
+    import warnings
+    warnings.simplefilter('ignore')
     main()



More information about the Zodb-checkins mailing list