##// END OF EJS Templates
run-tests: define custom result and runner classes for unittest...
Gregory Szorc -
r21429:203ed3cf default
parent child Browse files
Show More
@@ -982,6 +982,19 b' def run(cmd, wd, options, replacements, '
982 982
983 983 iolock = threading.Lock()
984 984
985 class TestResult(unittest._TextTestResult):
986 """Holds results when executing via unittest."""
987 # Don't worry too much about accessing the non-public _TextTestResult.
988 # It is relatively common in Python testing tools.
989 def __init__(self, *args, **kwargs):
990 super(TestResult, self).__init__(*args, **kwargs)
991
992 class TextTestRunner(unittest.TextTestRunner):
993 """Custom unittest test runner that uses appropriate settings."""
994
995 def _makeResult(self):
996 return TestResult(self.stream, self.descriptions, self.verbosity)
997
985 998 class TestRunner(object):
986 999 """Holds context for executing tests.
987 1000
@@ -1191,7 +1204,7 b' class TestRunner(object):'
1191 1204 verbosity = 1
1192 1205 if self.options.verbose:
1193 1206 verbosity = 2
1194 runner = unittest.TextTestRunner(verbosity=verbosity)
1207 runner = TextTestRunner(verbosity=verbosity)
1195 1208 runner.run(suite)
1196 1209 else:
1197 1210 self._executetests(tests)
General Comments 0
You need to be logged in to leave comments. Login now