Mercurial > hg
comparison tests/run-tests.py @ 21449:aedf18bcde11
run-tests: store test return code and output in Test instance
A subsequent patch that will introduce tearDown() requires test
execution state be stored in the instance.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Apr 2014 14:58:36 -0700 |
parents | f2dbbcacc763 |
children | a6e40416f172 |
comparison
equal
deleted
inserted
replaced
21448:f2dbbcacc763 | 21449:aedf18bcde11 |
---|---|
355 self._refpath = refpath | 355 self._refpath = refpath |
356 self._errpath = errpath | 356 self._errpath = errpath |
357 self._unittest = unittest | 357 self._unittest = unittest |
358 | 358 |
359 self._finished = None | 359 self._finished = None |
360 self._ret = None | |
361 self._out = None | |
360 | 362 |
361 # If we're not in --debug mode and reference output file exists, | 363 # If we're not in --debug mode and reference output file exists, |
362 # check test output against it. | 364 # check test output against it. |
363 if runner.options.debug: | 365 if runner.options.debug: |
364 self._refout = None # to match "out is None" | 366 self._refout = None # to match "out is None" |
380 shutil.rmtree(self._threadtmp, True) | 382 shutil.rmtree(self._threadtmp, True) |
381 | 383 |
382 def setUp(self): | 384 def setUp(self): |
383 """Tasks to perform before run().""" | 385 """Tasks to perform before run().""" |
384 self._finished = False | 386 self._finished = False |
387 self._ret = None | |
388 self._out = None | |
385 | 389 |
386 def run(self): | 390 def run(self): |
387 """Run this test instance. | 391 """Run this test instance. |
388 | 392 |
389 This will return a tuple describing the result of the test. | 393 This will return a tuple describing the result of the test. |
431 starttime = time.time() | 435 starttime = time.time() |
432 try: | 436 try: |
433 ret, out = self._run(testtmp, replacements, env) | 437 ret, out = self._run(testtmp, replacements, env) |
434 duration = time.time() - starttime | 438 duration = time.time() - starttime |
435 self._finished = True | 439 self._finished = True |
440 self._ret = ret | |
441 self._out = out | |
436 except KeyboardInterrupt: | 442 except KeyboardInterrupt: |
437 duration = time.time() - starttime | 443 duration = time.time() - starttime |
438 log('INTERRUPTED: %s (after %d seconds)' % (self.name, duration)) | 444 log('INTERRUPTED: %s (after %d seconds)' % (self.name, duration)) |
439 raise | 445 raise |
440 except Exception, e: | 446 except Exception, e: |