changeset 21506:bfe2616a2b0e

run-tests: no longer pass a TestRunner into Test.__init__ We no longer access any attributes on TestRunner besides options, so we stop passing a TestRunner to Test.__init__ and now pass the options data structure instead. Subsequent patches will move accessed options attributes into named arguments.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 22 Apr 2014 10:13:41 -0700
parents 3a1881dbf860
children d839e4820da7
files tests/run-tests.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Tue Apr 22 10:12:19 2014 -0700
+++ b/tests/run-tests.py	Tue Apr 22 10:13:41 2014 -0700
@@ -338,10 +338,10 @@
     # Status code reserved for skipped tests (used by hghave).
     SKIPPED_STATUS = 80
 
-    def __init__(self, runner, path, count, tmpdir, abort):
+    def __init__(self, options, path, count, tmpdir, abort):
         """Create a test from parameters.
 
-        runner is a TestRunner instance.
+        options are parsed command line options that control test execution.
 
         path is the full path to the file defining the test.
 
@@ -358,8 +358,7 @@
         self._testdir = os.path.dirname(path)
         self._errpath = os.path.join(self._testdir, '%s.err' % self.name)
 
-        self._runner = runner
-        self._options = runner.options
+        self._options = options
         self._count = count
         self._threadtmp = tmpdir
         self._abort = abort
@@ -373,7 +372,7 @@
 
         # If we're not in --debug mode and reference output file exists,
         # check test output against it.
-        if runner.options.debug:
+        if options.debug:
             self._refout = None # to match "out is None"
         elif os.path.exists(self._refpath):
             f = open(self._refpath, 'r')
@@ -1475,7 +1474,7 @@
         refpath = os.path.join(self.testdir, test)
         tmpdir = os.path.join(self.hgtmp, 'child%d' % count)
 
-        return testcls(self, refpath, count, tmpdir, self.abort)
+        return testcls(self.options, refpath, count, tmpdir, self.abort)
 
     def _cleanup(self):
         """Clean up state from this test invocation."""