# HG changeset patch # User Gregory Szorc # Date 2014-04-20 21:52:57 # Node ID f8c5b8a288c5a55bd682cbd7a64afc9b7603a3c6 # Parent 9a3b4f795f62c5ea00393e33c0ebe5c08ea8f978 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. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -356,6 +356,8 @@ class Test(object): 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 @@ class Test(object): 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 @@ class Test(object): 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))