Mercurial > hg-stable
changeset 21447:f8c5b8a288c5
run-tests: keep track of test execution state in Test
This patch starts a mini series of moving functionality into the
newly-established setUp() and tearDown() methods.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 14:52:57 -0700 |
parents | 9a3b4f795f62 |
children | f2dbbcacc763 |
files | tests/run-tests.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Sun Apr 20 14:41:11 2014 -0700 +++ b/tests/run-tests.py Sun Apr 20 14:52:57 2014 -0700 @@ -356,6 +356,8 @@ self._errpath = errpath self._unittest = unittest + self._finished = None + # If we're not in --debug mode and reference output file exists, # check test output against it. if runner.options.debug: @@ -379,12 +381,16 @@ def setUp(self): """Tasks to perform before run().""" + self._finished = False def run(self): """Run this test instance. This will return a tuple describing the result of the test. """ + if not self._unittest: + self.setUp() + if not os.path.exists(self._path): return self.skip("Doesn't exist") @@ -426,6 +432,7 @@ try: ret, out = self._run(testtmp, replacements, env) duration = time.time() - starttime + self._finished = True except KeyboardInterrupt: duration = time.time() - starttime log('INTERRUPTED: %s (after %d seconds)' % (self.name, duration))