run-tests: make testdir an argument of TestSuite.__init__
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 25 Apr 2014 15:11:38 -0700
changeset 21533 aecac8059c00
parent 21532 9d2ba7e2324d
child 21534 3ece55d16044
run-tests: make testdir an argument of TestSuite.__init__ With this change, TestSuite no longer accesses anything on TestRunner and the TestRunner is no longer passed to TestSuite.
tests/run-tests.py
--- a/tests/run-tests.py	Fri Apr 25 15:08:03 2014 -0700
+++ b/tests/run-tests.py	Fri Apr 25 15:11:38 2014 -0700
@@ -1153,11 +1153,15 @@
 class TestSuite(unittest.TestSuite):
     """Custom unitest TestSuite that knows how to execute Mercurial tests."""
 
-    def __init__(self, runner, jobs=1, whitelist=None, blacklist=None,
+    def __init__(self, testdir, jobs=1, whitelist=None, blacklist=None,
                  retest=False, keywords=None, loop=False,
                  *args, **kwargs):
         """Create a new instance that can run tests with a configuration.
 
+        testdir specifies the directory where tests are executed from. This
+        is typically the ``tests`` directory from Mercurial's source
+        repository.
+
         jobs specifies the number of jobs to run concurrently. Each test
         executes on its own thread. Tests actually spawn new processes, so
         state mutation should not be an issue.
@@ -1179,7 +1183,6 @@
         """
         super(TestSuite, self).__init__(*args, **kwargs)
 
-        self._runner = runner
         self._jobs = jobs
         self._whitelist = whitelist
         self._blacklist = blacklist
@@ -1509,7 +1512,8 @@
             failed = False
             warned = False
 
-            suite = TestSuite(self, jobs=self.options.jobs,
+            suite = TestSuite(self.testdir,
+                              jobs=self.options.jobs,
                               whitelist=self.options.whitelisted,
                               blacklist=self.options.blacklist,
                               retest=self.options.retest,