[PATCH 012 of 179 tests-refactor] run-tests: give TestResult a skipped attribute

Gregory Szorc gregory.szorc at gmail.com
Fri May 2 13:37:29 CDT 2014


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1397941278 25200
#      Sat Apr 19 14:01:18 2014 -0700
# Branch stable
# Node ID eb3f807fc79740895e93eaa39ca1dee890a51173
# Parent  3533e57a0390713ae8b0ab201d4bb3c20d8f6c65
run-tests: give TestResult a skipped attribute

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -642,16 +642,21 @@ class TestResult(object):
 
     def __init__(self):
         self.ret = None
         self.out = None
         self.duration = None
         self.interrupted = False
         self.exception = None
 
+    @property
+    def skipped(self):
+        """Whether the test was skipped."""
+        return self.ret == SKIPPED_STATUS
+
 def pytest(test, wd, options, replacements, env):
     py3kswitch = options.py3k_warnings and ' -3' or ''
     cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test)
     vlog("# Running", cmd)
     if os.name == 'nt':
         replacements.append((r'\r\n', '\n'))
     return run(cmd, wd, options, replacements, env)
 
@@ -1058,17 +1063,17 @@ def runone(options, test, count):
         return fail('Exception during execution: %s' % res.exception, 255)
 
     ret = res.ret
     out = res.out
 
     times.append((test, res.duration))
     vlog("# Ret was:", ret)
 
-    skipped = (ret == SKIPPED_STATUS)
+    skipped = res.skipped
 
     # If we're not in --debug mode and reference output file exists,
     # check test output against it.
     if options.debug:
         refout = None                   # to match "out is None"
     elif os.path.exists(ref):
         f = open(ref, "r")
         refout = f.read().splitlines(True)


More information about the Mercurial-devel mailing list