##// END OF EJS Templates
run-tests: remove remaining uses of TestResult
Gregory Szorc -
r21336:45ab0668 default
parent child Browse files
Show More
@@ -581,15 +581,13 b' class Test(object):'
581 581 if self._threadtmp and not self._options.keep_tmpdir:
582 582 shutil.rmtree(self._threadtmp, True)
583 583
584 def run(self, result):
584 def run(self):
585 585 if not os.path.exists(self._path):
586 result.skipped = True
587 586 return self.skip("Doesn't exist")
588 587
589 588 options = self._options
590 589 if not (options.whitelisted and self._test in options.whitelisted):
591 590 if options.blacklist and self._test in options.blacklist:
592 result.skipped = True
593 591 return self.skip('blacklisted')
594 592
595 593 if options.retest and not os.path.exists('%s.err' % self._test):
@@ -620,20 +618,14 b' class Test(object):'
620 618 createhgrc(env['HGRCPATH'], options)
621 619
622 620 starttime = time.time()
623
624 def updateduration():
625 result.duration = time.time() - starttime
626
627 621 try:
628 622 ret, out = self._run(testtmp, replacements, env)
629 updateduration()
623 duration = time.time() - starttime
630 624 except KeyboardInterrupt:
631 updateduration()
632 log('INTERRUPTED: %s (after %d seconds)' % (self._test,
633 result.duration))
625 duration = time.time() - starttime
626 log('INTERRUPTED: %s (after %d seconds)' % (self._test, duration))
634 627 raise
635 628 except Exception, e:
636 updateduration()
637 629 return self.fail('Exception during execution: %s' % e, 255)
638 630
639 631 killdaemons(env['DAEMON_PIDS'])
@@ -646,6 +638,8 b' class Test(object):'
646 638 return 'killed by signal: %d' % -ret
647 639 return 'returned error code %d' % ret
648 640
641 skipped = False
642
649 643 if ret == SKIPPED_STATUS:
650 644 if out is None: # Debug mode, nothing to parse.
651 645 missing = ['unknown']
@@ -660,7 +654,7 b' class Test(object):'
660 654 res = self.fail('hg have failed checking for %s' % failed[-1],
661 655 ret)
662 656 else:
663 result.skipped = True
657 skipped = True
664 658 res = self.skip(missing[-1])
665 659 elif ret == 'timeout':
666 660 res = self.fail('timed out', ret)
@@ -689,7 +683,7 b' class Test(object):'
689 683 else:
690 684 res = self.success()
691 685
692 if (ret != 0 or out != self._refout) and not result.skipped \
686 if (ret != 0 or out != self._refout) and not skipped \
693 687 and not options.debug:
694 688 f = open(self._errpath, 'wb')
695 689 for line in out:
@@ -704,6 +698,8 b' class Test(object):'
704 698 sys.stdout.flush()
705 699 iolock.release()
706 700
701 times.append((self._test, duration))
702
707 703 return res
708 704
709 705 def _run(self, testtmp, replacements, env):
@@ -795,13 +791,6 b' class Test(object):'
795 791 def ignore(self, msg):
796 792 return 'i', self._test, msg
797 793
798 class TestResult(object):
799 """Holds the result of a test execution."""
800
801 def __init__(self):
802 self.duration = None
803 self.skipped = False
804
805 794 class PythonTest(Test):
806 795 """A Python-based test."""
807 796 def _run(self, testtmp, replacements, env):
@@ -1158,10 +1147,7 b' def runone(options, test, count):'
1158 1147 vlog("# Test", test)
1159 1148
1160 1149 t = runner(test, testpath, options, count, ref, err)
1161 res = TestResult()
1162 result = t.run(res)
1163
1164 times.append((test, res.duration))
1150 result = t.run()
1165 1151
1166 1152 t.cleanup()
1167 1153
General Comments 0
You need to be logged in to leave comments. Login now