# HG changeset patch # User Matt Mackall # Date 2013-06-02 21:22:51 # Node ID f4247d7e20463f77e9cea2e794a1af323624d9be # Parent 36dc45b1f427ef34c73f63abc34b5b9a948965f6 run-tests: move environment creation to a separate function diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -362,6 +362,17 @@ def createhgrc(path, options): hgrc.write('[%s]\n%s\n' % (section, key)) hgrc.close() +def createenv(options, testtmp): + env = os.environ.copy() + env['TESTTMP'] = testtmp + env['HOME'] = testtmp + env["HGPORT"] = str(options.port) + env["HGPORT1"] = str(options.port + 1) + env["HGPORT2"] = str(options.port + 2) + env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc') + env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids') + + return env def checktools(): # Before we go any further, check for pre-requisite tools @@ -927,15 +938,7 @@ def runone(options, test): else: replacements.append((re.escape(testtmp), '$TESTTMP')) - env = os.environ.copy() - env['TESTTMP'] = testtmp - env['HOME'] = testtmp - env["HGPORT"] = str(options.port) - env["HGPORT1"] = str(options.port + 1) - env["HGPORT2"] = str(options.port + 2) - env["HGRCPATH"] = os.path.join(HGTMP, '.hgrc') - env["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids') - + env = createenv(options, testtmp) createhgrc(env['HGRCPATH'], options) if options.time: