D-Bus testing: use Python >= 2.7 assertions

The "if True" was used for debugging the fallback code. The check for
availability was broken, it needs to look at unittest.TestCase. Now
the code uses the fallback only if necessary, as originally intended.
This commit is contained in:
Patrick Ohly 2012-04-27 09:04:53 +02:00
parent a093c655cf
commit 9118f54c1b
1 changed files with 3 additions and 3 deletions

View File

@ -892,13 +892,13 @@ class DBusUtil(Timeout):
self.fail("'" + str(needle) + "' found in '" + str(haystack) + "'")
# reimplement Python 2.7 assertions only in older Python
if True or not 'assertRegexpMatches' in dir(self):
if not 'assertRegexpMatches' in dir(unittest.TestCase):
assertRegexpMatches = assertRegexpMatchesCustom
if True or not 'assertIn' in dir(self):
if not 'assertIn' in dir(unittest.TestCase):
assertIn = assertInCustom
if True or not 'assertNotIn' in dir(self):
if not 'assertNotIn' in dir(unittest.TestCase):
assertNotIn = assertNotInCustom
class TestDBusServer(unittest.TestCase, DBusUtil):