tests: fix run-tests default values in Test constructor
authorAugie Fackler <augie@google.com>
Tue, 19 Sep 2017 00:06:57 -0400
changeset 34264 8999851a503f
parent 34263 1533371769b5
child 34265 df1c290df034
tests: fix run-tests default values in Test constructor As far as I can tell, default values are evaluated far earlier on Python 3.6 than 2.7, meaning we've got to be more careful about when we read the defaults dictionary for the kwarg defaults. Sigh. With this change, test-run-tests.t is significantly less of a mess under 3.6.
tests/run-tests.py
--- a/tests/run-tests.py	Mon Sep 18 17:11:32 2017 -0400
+++ b/tests/run-tests.py	Tue Sep 19 00:06:57 2017 -0400
@@ -659,10 +659,10 @@
 
     def __init__(self, path, outputdir, tmpdir, keeptmpdir=False,
                  debug=False,
-                 timeout=defaults['timeout'],
-                 startport=defaults['port'], extraconfigopts=None,
+                 timeout=None,
+                 startport=None, extraconfigopts=None,
                  py3kwarnings=False, shell=None, hgcommand=None,
-                 slowtimeout=defaults['slowtimeout'], usechg=False,
+                 slowtimeout=None, usechg=False,
                  useipv6=False):
         """Create a test from parameters.
 
@@ -694,6 +694,12 @@
 
         shell is the shell to execute tests in.
         """
+        if timeout is None:
+            timeout = defaults['timeout']
+        if startport is None:
+            startport = defaults['port']
+        if slowtimeout is None:
+            slowtimeout = defaults['slowtimeout']
         self.path = path
         self.bname = os.path.basename(path)
         self.name = _strpath(self.bname)