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

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:37 p.m.
Message ID <eb3f807fc79740895e93.1399055849@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4507/
State Accepted
Commit cd4fd7b3c3c4c3b98b4fa39e7d9be8a6d4c371ba
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:37 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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

Patch

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)