[Zodb-checkins] SVN: ZODB/branches/tseaver-squelch_2.6_warnings/src/ Suppress warnings during test runs.

Tres Seaver tseaver at palladion.com
Wed Feb 9 12:50:40 EST 2011


Log message for revision 120246:
  Suppress warnings during test runs.

Changed:
  U   ZODB/branches/tseaver-squelch_2.6_warnings/src/BTrees/tests/test_compare.py
  U   ZODB/branches/tseaver-squelch_2.6_warnings/src/ZEO/tests/zeoserver.py

-=-
Modified: ZODB/branches/tseaver-squelch_2.6_warnings/src/BTrees/tests/test_compare.py
===================================================================
--- ZODB/branches/tseaver-squelch_2.6_warnings/src/BTrees/tests/test_compare.py	2011-02-09 17:48:54 UTC (rev 120245)
+++ ZODB/branches/tseaver-squelch_2.6_warnings/src/BTrees/tests/test_compare.py	2011-02-09 17:50:40 UTC (rev 120246)
@@ -47,8 +47,17 @@
         self.assertRaises(UnicodeError, callable, *args)
 
     def testBucketGet(self):
-        self.bucket[self.s] = 1
-        self.assertUE(self.bucket.get, self.u)
+        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
+        self.assertEqual(len(_warnlog), 1)
 
     def testSetGet(self):
         self.set.insert(self.s)

Modified: ZODB/branches/tseaver-squelch_2.6_warnings/src/ZEO/tests/zeoserver.py
===================================================================
--- ZODB/branches/tseaver-squelch_2.6_warnings/src/ZEO/tests/zeoserver.py	2011-02-09 17:48:54 UTC (rev 120245)
+++ ZODB/branches/tseaver-squelch_2.6_warnings/src/ZEO/tests/zeoserver.py	2011-02-09 17:50:40 UTC (rev 120246)
@@ -210,4 +210,6 @@
 
 
 if __name__ == '__main__':
+    import warnings
+    warnings.simplefilter('ignore')
     main()



More information about the Zodb-checkins mailing list