From 7a9ce26aaf03459a7ea367fbdb91d91626a1ee93 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 22 Mar 2013 15:12:35 -0400 Subject: py2.6 doesn't support TextTestRunner resultclass Updates tools/colorizer to account for the fact that Python 2.6 doesn't support resultclass. This fixes issue in trying to use run_tests.sh on distributions which use python 2.6. Fixes LP Bug #1158940 Change-Id: I763cd9c7a4b5ec5baaad3a3d9ee96e6e3cd13b3e --- tools/colorizer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/colorizer.py b/tools/colorizer.py index 50534d3fb..2df3c2bf8 100755 --- a/tools/colorizer.py +++ b/tools/colorizer.py @@ -304,8 +304,12 @@ class NovaTestResult(testtools.TestResult): test = subunit.ProtocolTestCase(sys.stdin, passthrough=None) -runner = unittest.TextTestRunner(verbosity=2, - resultclass=NovaTestResult) + +if sys.version_info <= (2, 6): + runner = unittest.TextTestRunner(verbosity=2) +else: + runner = unittest.TextTestRunner(verbosity=2, resultclass=NovaTestResult) + if runner.run(test).wasSuccessful(): exit_code = 0 else: -- cgit