summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-08 00:21:07 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-08 23:54:17 +0000
commit43c8fce45c858e96cb1cbb24d2623d721bbbf51c (patch)
tree93b2bc1ed935313d88672c3b35c0703577be709b
parentac5cde8834c85eb0a7cd12812164ce562daeb32a (diff)
downloadpsycopg2-43c8fce45c858e96cb1cbb24d2623d721bbbf51c.tar.gz
Silence warnings due to deprecated TestCase methods
With a veiled criticism.
-rw-r--r--tests/testutils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/testutils.py b/tests/testutils.py
index 49d26b2..6738718 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -41,6 +41,16 @@ else:
unittest.TestCase.skipTest = skipTest
+# Silence warnings caused by the stubborness of the Python unittest maintainers
+# http://bugs.python.org/issue9424
+if not hasattr(unittest.TestCase, 'assert_') \
+or unittest.TestCase.assert_ is not unittest.TestCase.assertTrue:
+ # mavaff...
+ unittest.TestCase.assert_ = unittest.TestCase.assertTrue
+ unittest.TestCase.failUnless = unittest.TestCase.assertTrue
+ unittest.TestCase.assertEquals = unittest.TestCase.assertEqual
+ unittest.TestCase.failUnlessEqual = unittest.TestCase.assertEqual
+
def decorate_all_tests(cls, decorator):
"""Apply *decorator* to all the tests defined in the TestCase *cls*."""