##// END OF EJS Templates
run-tests: add skip processing to Test
Gregory Szorc -
r21324:6454ddae default
parent child Browse files
Show More
@@ -619,6 +619,23 b' class Test(object):'
619 if not self._options.keep_tmpdir:
619 if not self._options.keep_tmpdir:
620 shutil.rmtree(testtmp)
620 shutil.rmtree(testtmp)
621
621
622 if ret == SKIPPED_STATUS:
623 if out is None: # Debug mode, nothing to parse.
624 missing = ['unknown']
625 failed = None
626 else:
627 missing, failed = parsehghaveoutput(out)
628
629 if not missing:
630 missing = ['irrelevant']
631
632 if failed:
633 return self.fail('hg have failed checking for %s' % failed[-1],
634 ret)
635 else:
636 result.skipped = True
637 return self.skip(missing[-1])
638
622 def _run(self, testtmp, replacements, env):
639 def _run(self, testtmp, replacements, env):
623 raise NotImplemented('Subclasses must implement Test.run()')
640 raise NotImplemented('Subclasses must implement Test.run()')
624
641
@@ -699,6 +716,12 b' class Test(object):'
699
716
700 return warned and '~' or '!', self._test, msg
717 return warned and '~' or '!', self._test, msg
701
718
719 def skip(self, msg):
720 if self._options.verbose:
721 log("\nSkipping %s: %s" % (self._path, msg))
722
723 return 's', self._test, msg
724
702 class TestResult(object):
725 class TestResult(object):
703 """Holds the result of a test execution."""
726 """Holds the result of a test execution."""
704
727
@@ -708,11 +731,7 b' class TestResult(object):'
708 self.duration = None
731 self.duration = None
709 self.exception = None
732 self.exception = None
710 self.refout = None
733 self.refout = None
711
734 self.skipped = False
712 @property
713 def skipped(self):
714 """Whether the test was skipped."""
715 return self.ret == SKIPPED_STATUS
716
735
717 class PythonTest(Test):
736 class PythonTest(Test):
718 """A Python-based test."""
737 """A Python-based test."""
@@ -1101,7 +1120,7 b' def runone(options, test, count):'
1101
1120
1102 t = runner(test, testpath, options, count, ref, err)
1121 t = runner(test, testpath, options, count, ref, err)
1103 res = TestResult()
1122 res = TestResult()
1104 t.run(res)
1123 result = t.run(res)
1105
1124
1106 if res.exception:
1125 if res.exception:
1107 return t.fail('Exception during execution: %s' % res.exception, 255)
1126 return t.fail('Exception during execution: %s' % res.exception, 255)
@@ -1122,19 +1141,8 b' def runone(options, test, count):'
1122 f.write(line)
1141 f.write(line)
1123 f.close()
1142 f.close()
1124
1143
1125 if skipped:
1144 if result:
1126 if out is None: # debug mode: nothing to parse
1145 pass
1127 missing = ['unknown']
1128 failed = None
1129 else:
1130 missing, failed = parsehghaveoutput(out)
1131 if not missing:
1132 missing = ['irrelevant']
1133 if failed:
1134 result = t.fail("hghave failed checking for %s" % failed[-1], ret)
1135 skipped = False
1136 else:
1137 result = skip(missing[-1])
1138 elif ret == 'timeout':
1146 elif ret == 'timeout':
1139 result = t.fail("timed out", ret)
1147 result = t.fail("timed out", ret)
1140 elif out != refout:
1148 elif out != refout:
General Comments 0
You need to be logged in to leave comments. Login now