# HG changeset patch # User Augie Fackler # Date 2017-09-19 04:06:57 # Node ID 8999851a503fa13a84a6a1343be3ca9b882bc3d8 # Parent 1533371769b5ad3de2c7aa1ed08ee7cfb99c0c91 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. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -659,10 +659,10 @@ class Test(unittest.TestCase): 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 @@ class Test(unittest.TestCase): 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)