run-tests: no longer pass a TestRunner into Test.__init__
authorGregory Szorc <gregory.szorc@gmail.com>
Tue, 22 Apr 2014 10:13:41 -0700
changeset 21506 bfe2616a2b0e
parent 21505 3a1881dbf860
child 21507 d839e4820da7
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.
tests/run-tests.py
--- 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."""