[PATCH 035 of 179 tests-refactor] run-tests: move retesting result to Test.run()

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


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1397966648 25200
#      Sat Apr 19 21:04:08 2014 -0700
# Branch stable
# Node ID 8f54e7d2536ab22b6117f5e77e2c6981b9b14c6b
# Parent  068caaa57910a2eac90970679e00d768fdd06a51
run-tests: move retesting result to Test.run()

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -585,16 +585,19 @@ class Test(object):
             return self.skip("Doesn't exist")
 
         options = self._options
         if not (options.whitelisted and self._test in options.whitelisted):
             if options.blacklist and self._test in options.blacklist:
                 result.skipped = True
                 return self.skip('blacklisted')
 
+            if options.retest and not os.path.exists('%s.err' % self._test):
+                return self.ignore('not retesting')
+
         # Remove any previous output files.
         if os.path.exists(self._errpath):
             os.remove(self._errpath)
 
         testtmp = os.path.join(self._threadtmp, os.path.basename(self._path))
         os.mkdir(testtmp)
         replacements, port = self._getreplacements(testtmp)
         env = self._getenv(testtmp, port)
@@ -756,16 +759,19 @@ class Test(object):
         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
 
+    def ignore(self, msg):
+        return 'i', self._test, msg
+
 class TestResult(object):
     """Holds the result of a test execution."""
 
     def __init__(self):
         self.ret = None
         self.out = None
         self.duration = None
         self.exception = None
@@ -1108,27 +1114,21 @@ def run(cmd, wd, options, replacements, 
 def runone(options, test, count):
     '''returns a result element: (code, test, msg)'''
 
     def skip(msg):
         if options.verbose:
             log("\nSkipping %s: %s" % (testpath, msg))
         return 's', test, msg
 
-    def ignore(msg):
-        return 'i', test, msg
-
     testpath = os.path.join(TESTDIR, test)
     err = os.path.join(TESTDIR, test + ".err")
     lctest = test.lower()
 
     if not (options.whitelisted and test in options.whitelisted):
-        if options.retest and not os.path.exists(test + ".err"):
-            return ignore("not retesting")
-
         if options.keywords:
             fp = open(test)
             t = fp.read().lower() + test.lower()
             fp.close()
             for k in options.keywords.lower().split():
                 if k in t:
                     break
                 else:


More information about the Mercurial-devel mailing list