[PATCH 016 of 179 tests-refactor] run-tests: roll pytest() into PythonTest._run()

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


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1397944444 25200
#      Sat Apr 19 14:54:04 2014 -0700
# Branch stable
# Node ID b81c0cdec1404e692bf042c67632d65f92fdf9d3
# Parent  9c0fd7bcc4b7a6bc574bde7d8c76131ab669972c
run-tests: roll pytest() into PythonTest._run()

Python was the old runner function. It no longer needs to exist since
the PythonTest class took its job.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -668,29 +668,26 @@ class TestResult(object):
         self.exception = None
         self.refout = 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)
-
 class PythonTest(Test):
     """A Python-based test."""
     def _run(self, testtmp, replacements, env):
-        return pytest(self._path, testtmp, self._options, replacements,
-                      env)
+        py3kswitch = self._options.py3k_warnings and ' -3' or ''
+        cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self._path)
+        vlog("# Running", cmd)
+        if os.name == 'nt':
+            replacements.append((r'\r\n', '\n'))
+        return run(cmd, testtmp, self._options, replacements, env)
+
 
 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub
 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256))
 escapemap.update({'\\': '\\\\', '\r': r'\r'})
 def escapef(m):
     return escapemap[m.group(0)]
 def stringescape(s):


More information about the Mercurial-devel mailing list