[PATCH 3 of 5] run-tests: move bits of main program so it's all at the bottom

Greg Ward greg-hg at gerg.ca
Mon Apr 20 20:53:09 CDT 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1240276239 14400
# Node ID 6b88393c8d80234d131bfdda0bd8e2c62ce90e5a
# Parent  2b49b25aabf6059d228d9447ba16cf2da8a0b8dc
run-tests: move bits of main program so it's all at the bottom.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -496,45 +496,6 @@
         return None
     return ret == 0
 
-(options, args) = parse_args()
-if not options.child:
-    os.umask(022)
-
-    check_required_tools()
-
-# Reset some environment variables to well-known values so that
-# the tests produce repeatable output.
-os.environ['LANG'] = os.environ['LC_ALL'] = 'C'
-os.environ['TZ'] = 'GMT'
-os.environ["EMAIL"] = "Foo Bar <foo.bar at example.com>"
-os.environ['CDPATH'] = ''
-
-TESTDIR = os.environ["TESTDIR"] = os.getcwd()
-HGTMP = os.environ['HGTMP'] = os.path.realpath(tempfile.mkdtemp('', 'hgtests.',
-                                               options.tmpdir))
-DAEMON_PIDS = None
-HGRCPATH = None
-
-os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
-os.environ["HGMERGE"] = "internal:merge"
-os.environ["HGUSER"]   = "test"
-os.environ["HGENCODING"] = "ascii"
-os.environ["HGENCODINGMODE"] = "strict"
-os.environ["HGPORT"] = str(options.port)
-os.environ["HGPORT1"] = str(options.port + 1)
-os.environ["HGPORT2"] = str(options.port + 2)
-
-if options.with_hg:
-    INST = options.with_hg
-else:
-    INST = os.path.join(HGTMP, "install")
-BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin")
-PYTHONDIR = os.path.join(INST, "lib", "python")
-COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
-
-expecthg = os.path.join(HGTMP, 'install', 'lib', 'python', 'mercurial')
-hgpkg = None
-
 def run_children(tests):
     if not options.with_hg:
         install_hg()
@@ -686,6 +647,45 @@
     if failed:
         sys.exit(1)
 
+(options, args) = parse_args()
+if not options.child:
+    os.umask(022)
+
+    check_required_tools()
+
+# Reset some environment variables to well-known values so that
+# the tests produce repeatable output.
+os.environ['LANG'] = os.environ['LC_ALL'] = 'C'
+os.environ['TZ'] = 'GMT'
+os.environ["EMAIL"] = "Foo Bar <foo.bar at example.com>"
+os.environ['CDPATH'] = ''
+
+TESTDIR = os.environ["TESTDIR"] = os.getcwd()
+HGTMP = os.environ['HGTMP'] = os.path.realpath(tempfile.mkdtemp('', 'hgtests.',
+                                               options.tmpdir))
+DAEMON_PIDS = None
+HGRCPATH = None
+
+os.environ["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"'
+os.environ["HGMERGE"] = "internal:merge"
+os.environ["HGUSER"]   = "test"
+os.environ["HGENCODING"] = "ascii"
+os.environ["HGENCODINGMODE"] = "strict"
+os.environ["HGPORT"] = str(options.port)
+os.environ["HGPORT1"] = str(options.port + 1)
+os.environ["HGPORT2"] = str(options.port + 2)
+
+if options.with_hg:
+    INST = options.with_hg
+else:
+    INST = os.path.join(HGTMP, "install")
+BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin")
+PYTHONDIR = os.path.join(INST, "lib", "python")
+COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
+
+expecthg = os.path.join(HGTMP, 'install', 'lib', 'python', 'mercurial')
+hgpkg = None
+
 if len(args) == 0:
     args = os.listdir(".")
     args.sort()


More information about the Mercurial-devel mailing list