mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
run-tests: add skip processing to Test
This commit is contained in:
parent
d792278ce6
commit
3573cbd388
@ -619,6 +619,23 @@ class Test(object):
|
|||||||
if not self._options.keep_tmpdir:
|
if not self._options.keep_tmpdir:
|
||||||
shutil.rmtree(testtmp)
|
shutil.rmtree(testtmp)
|
||||||
|
|
||||||
|
if ret == SKIPPED_STATUS:
|
||||||
|
if out is None: # Debug mode, nothing to parse.
|
||||||
|
missing = ['unknown']
|
||||||
|
failed = None
|
||||||
|
else:
|
||||||
|
missing, failed = parsehghaveoutput(out)
|
||||||
|
|
||||||
|
if not missing:
|
||||||
|
missing = ['irrelevant']
|
||||||
|
|
||||||
|
if failed:
|
||||||
|
return self.fail('hg have failed checking for %s' % failed[-1],
|
||||||
|
ret)
|
||||||
|
else:
|
||||||
|
result.skipped = True
|
||||||
|
return self.skip(missing[-1])
|
||||||
|
|
||||||
def _run(self, testtmp, replacements, env):
|
def _run(self, testtmp, replacements, env):
|
||||||
raise NotImplemented('Subclasses must implement Test.run()')
|
raise NotImplemented('Subclasses must implement Test.run()')
|
||||||
|
|
||||||
@ -699,6 +716,12 @@ class Test(object):
|
|||||||
|
|
||||||
return warned and '~' or '!', self._test, msg
|
return warned and '~' or '!', self._test, msg
|
||||||
|
|
||||||
|
def skip(self, msg):
|
||||||
|
if self._options.verbose:
|
||||||
|
log("\nSkipping %s: %s" % (self._path, msg))
|
||||||
|
|
||||||
|
return 's', self._test, msg
|
||||||
|
|
||||||
class TestResult(object):
|
class TestResult(object):
|
||||||
"""Holds the result of a test execution."""
|
"""Holds the result of a test execution."""
|
||||||
|
|
||||||
@ -708,11 +731,7 @@ class TestResult(object):
|
|||||||
self.duration = None
|
self.duration = None
|
||||||
self.exception = None
|
self.exception = None
|
||||||
self.refout = None
|
self.refout = None
|
||||||
|
self.skipped = False
|
||||||
@property
|
|
||||||
def skipped(self):
|
|
||||||
"""Whether the test was skipped."""
|
|
||||||
return self.ret == SKIPPED_STATUS
|
|
||||||
|
|
||||||
class PythonTest(Test):
|
class PythonTest(Test):
|
||||||
"""A Python-based test."""
|
"""A Python-based test."""
|
||||||
@ -1101,7 +1120,7 @@ def runone(options, test, count):
|
|||||||
|
|
||||||
t = runner(test, testpath, options, count, ref, err)
|
t = runner(test, testpath, options, count, ref, err)
|
||||||
res = TestResult()
|
res = TestResult()
|
||||||
t.run(res)
|
result = t.run(res)
|
||||||
|
|
||||||
if res.exception:
|
if res.exception:
|
||||||
return t.fail('Exception during execution: %s' % res.exception, 255)
|
return t.fail('Exception during execution: %s' % res.exception, 255)
|
||||||
@ -1122,19 +1141,8 @@ def runone(options, test, count):
|
|||||||
f.write(line)
|
f.write(line)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if skipped:
|
if result:
|
||||||
if out is None: # debug mode: nothing to parse
|
pass
|
||||||
missing = ['unknown']
|
|
||||||
failed = None
|
|
||||||
else:
|
|
||||||
missing, failed = parsehghaveoutput(out)
|
|
||||||
if not missing:
|
|
||||||
missing = ['irrelevant']
|
|
||||||
if failed:
|
|
||||||
result = t.fail("hghave failed checking for %s" % failed[-1], ret)
|
|
||||||
skipped = False
|
|
||||||
else:
|
|
||||||
result = skip(missing[-1])
|
|
||||||
elif ret == 'timeout':
|
elif ret == 'timeout':
|
||||||
result = t.fail("timed out", ret)
|
result = t.fail("timed out", ret)
|
||||||
elif out != refout:
|
elif out != refout:
|
||||||
|
Loading…
Reference in New Issue
Block a user