[PATCH 1 of 3] run-tests: make runnable when --with-hg is set but not --child

Simon Heimberg simohe at besonet.ch
Wed Apr 22 09:46:56 CDT 2009


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1240384045 -7200
# Node ID 1538980b683765ef524da966006c4ecb917662c8
# Parent  c11636f0609effbb14964a6e8939c2e2d3453450
run-tests: make runnable when --with-hg is set but not --child

eliminate global hgpkg
the option with-hg only means not to install (hg found in PATH is used,
PYTHONPATH and PATH are only set on installation)

diff -r c11636f0609e -r 1538980b6837 tests/run-tests.py
--- a/tests/run-tests.py	Mit Apr 22 09:11:46 2009 +0200
+++ b/tests/run-tests.py	Mit Apr 22 09:07:25 2009 +0200
@@ -237,8 +237,6 @@
     os.environ["PYTHONPATH"] = pythonpath
 
     usecorrectpython()
-    global hgpkg
-    hgpkg = _hgpath()
 
     vlog("# Installing dummy diffstat")
     f = open(os.path.join(BINDIR, 'diffstat'), 'w')
@@ -493,8 +491,12 @@
     return ret == 0
 
 def runchildren(options, expecthg, tests):
-    if not options.with_hg:
+    if options.with_hg:
+        hgpkg = _hgpath()
+    else:
         installhg(options)
+
+        hgpkg = _hgpath()
         if hgpkg != expecthg:
             print '# Testing unexpected mercurial: %s' % hgpkg
 
@@ -561,11 +563,13 @@
     global DAEMON_PIDS, HGRCPATH
     DAEMON_PIDS = os.environ["DAEMON_PIDS"] = os.path.join(HGTMP, 'daemon.pids')
     HGRCPATH = os.environ["HGRCPATH"] = os.path.join(HGTMP, '.hgrc')
+    hgpkg = None
 
     try:
         if not options.with_hg:
             installhg(options)
 
+            hgpkg = _hgpath()
             if hgpkg != expecthg:
                 print '# Testing unexpected mercurial: %s' % hgpkg
 
@@ -629,6 +633,8 @@
                 print "Skipped %s: %s" % s
             for s in fails:
                 print "Failed %s: %s" % s
+            if not hgpkg:
+                hgpkg = _hgpath()
             if hgpkg != expecthg:
                 print '# Tested unexpected mercurial: %s' % hgpkg
             print "# Ran %d tests, %d skipped, %d failed." % (
@@ -682,7 +688,6 @@
     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(".")


More information about the Mercurial-devel mailing list