changeset 19269:f4247d7e2046

run-tests: move environment creation to a separate function
author Matt Mackall <mpm@selenic.com>
date Sun, 02 Jun 2013 16:22:51 -0500
parents 36dc45b1f427
children ac80a1cddf83
files tests/run-tests.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sun Jun 02 16:22:51 2013 -0500
+++ b/tests/run-tests.py	Sun Jun 02 16:22:51 2013 -0500
@@ -362,6 +362,17 @@
             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 @@
     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: