commit a42cd3eb4539b6038aecaea44d9a4cdd3e46d002 Author: Damian Johnson atagar@torproject.org Date: Thu Jul 20 12:06:30 2017 -0700
Move assertItemsEqual() into TimedTestRunner additions
The TimedTestRunner provides python 2.6 compatability for methods added later, but there was one method we previously wired into with run_tests.py. Moving this to the TimedTestRunner too for consistency's sake.
I'm a little tempted to deduplicate in favor of what run_tests.py does instead but I suppose this doesn't really matter since python 2.6 support will be going away with Stem 2.0. --- run_tests.py | 7 ------- stem/util/test_tools.py | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/run_tests.py b/run_tests.py index 0a799e4a..b9adf31c 100755 --- a/run_tests.py +++ b/run_tests.py @@ -64,13 +64,6 @@ New capabilities are: """
-if stem.prereq._is_python_26(): - def assertItemsEqual(self, expected, actual): - self.assertEqual(set(expected), set(actual)) - - unittest.TestCase.assertItemsEqual = assertItemsEqual - - def get_unit_tests(module_prefix = None): """ Provides the classes for our unit tests. diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py index 3094f5c0..d12ccf82 100644 --- a/stem/util/test_tools.py +++ b/stem/util/test_tools.py @@ -255,6 +255,12 @@ class TimedTestRunner(unittest.TextTestRunner):
# TODO: remove when dropping python 2.6 support
+ def assertItemsEqual(self, expected, actual): + if stem.prereq._is_python_26(): + self.assertEqual(set(expected), set(actual)) + else: + return super(original_type, self).assertItemsEqual(expected, actual) + def assertRaisesRegexp(self, exc_type, exc_msg, func, *args, **kwargs): if stem.prereq._is_python_26(): try: