# HG changeset patch # User Gregory Szorc # Date 1398021588 25200 # Node ID a264fca9181bcf50677c102a72c0804a61bc619f # Parent ff4a270bd3347eb2e2c05e651e707c421784f2d0 run-tests: teach Test instances whether they are in unittest mode Tests executing in unittest mode behave a little differently. For example, they report their results to a TestResult rather than just printing. This patch paves the way for better integration of Test into the unittest framework. diff -r ff4a270bd334 -r a264fca9181b tests/run-tests.py --- a/tests/run-tests.py Sun Apr 20 11:55:02 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 12:19:48 2014 -0700 @@ -347,7 +347,7 @@ # Status code reserved for skipped tests (used by hghave). SKIPPED_STATUS = 80 - def __init__(self, runner, test, count, refpath): + def __init__(self, runner, test, count, refpath, unittest=False): path = os.path.join(runner.testdir, test) errpath = os.path.join(runner.testdir, '%s.err' % test) @@ -360,6 +360,7 @@ self._daemonpids = [] self._refpath = refpath self._errpath = errpath + self._unittest = unittest # If we're not in --debug mode and reference output file exists, # check test output against it. @@ -1301,7 +1302,7 @@ refpath = os.path.join(self.testdir, test + out) break - t = testcls(self, test, count, refpath) + t = testcls(self, test, count, refpath, unittest=asunit) if not asunit: return t