From 43c8fce45c858e96cb1cbb24d2623d721bbbf51c Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 8 Jan 2011 00:21:07 +0000 Subject: [PATCH] Silence warnings due to deprecated TestCase methods With a veiled criticism. --- tests/testutils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/testutils.py b/tests/testutils.py index 49d26b21..67387187 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*."""