[PATCH 043 of 179 tests-refactor] run-tests: move computation of test paths into Test.__init__

Gregory Szorc gregory.szorc at gmail.com
Fri May 2 13:38:00 CDT 2014


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1397969595 25200
#      Sat Apr 19 21:53:15 2014 -0700
# Branch stable
# Node ID 17b756f8c979486ff5ef6a597566743226f82422
# Parent  f3d000a783487cedcb60436074661785c4518ffb
run-tests: move computation of test paths into Test.__init__

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -544,17 +544,20 @@ def outputcoverage(options):
 
 class Test(object):
     """Encapsulates a single, runnable test.
 
     Test instances can be run multiple times via run(). However, multiple
     runs cannot be run concurrently.
     """
 
-    def __init__(self, test, path, options, count, refpath, errpath):
+    def __init__(self, testdir, test, options, count, refpath):
+        path = os.path.join(testdir, test)
+        errpath = os.path.join(testdir, '%s.err' % test)
+
         self._test = test
         self._path = path
         self._options = options
         self._count = count
         self._daemonpids = []
         self._refpath = refpath
         self._errpath = errpath
 
@@ -1127,29 +1130,27 @@ 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
 
-    testpath = os.path.join(TESTDIR, test)
-    err = os.path.join(TESTDIR, test + ".err")
     lctest = test.lower()
 
     for ext, cls, out in testtypes:
         if lctest.endswith(ext):
             runner = cls
             ref = os.path.join(TESTDIR, test + out)
             break
     else:
         return skip("unknown test type")
 
-    t = runner(test, testpath, options, count, ref, err)
+    t = runner(TESTDIR, test, options, count, ref)
     result = t.run()
 
     del t # For cleanup side-effects.
 
     return result
 
 _hgpath = None
 


More information about the Mercurial-devel mailing list