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.
--- 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