Patchwork [052,of,179,tests-refactor] run-tests: move COVERAGE_FILE out of a global

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:38 p.m.
Message ID <9400acbcfb76c42c5b98.1399055889@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4547/
State Accepted
Commit 5b1b31137f95ddbb740c7ba3c054120fbf81aab9
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:38 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1397975231 25200
#      Sat Apr 19 23:27:11 2014 -0700
# Branch stable
# Node ID 9400acbcfb76c42c5b9852da42026b66c976e3ed
# Parent  ac0350f0cee1c2e23bab3aa275e5bb7560500040
run-tests: move COVERAGE_FILE out of a global

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1286,16 +1286,17 @@  class TestRunner(object):
     """
     def __init__(self):
         self.testdir = None
         self.hgtmp = None
         self.inst = None
         self.bindir = None
         self.tmpbinddir = None
         self.pythondir = None
+        self.coveragefile = None
 
 def main(args, parser=None):
     runner = TestRunner()
 
     parser = parser or getparser()
     (options, args) = parseargs(args, parser)
     os.umask(022)
 
@@ -1333,17 +1334,16 @@  def main(args, parser=None):
             return val
         tests.sort(key=sortkey)
 
     if 'PYTHONHASHSEED' not in os.environ:
         # use a random python hash seed all the time
         # we do the randomness ourself to know what seed is used
         os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
 
-    global COVERAGE_FILE
     runner.testdir = os.environ['TESTDIR'] = os.getcwd()
     if options.tmpdir:
         options.keep_tmpdir = True
         tmpdir = options.tmpdir
         if os.path.exists(tmpdir):
             # Meaning of tmpdir has changed since 1.3: we used to create
             # HGTMP inside tmpdir; now HGTMP is tmpdir.  So fail if
             # tmpdir already exists.
@@ -1402,17 +1402,17 @@  def main(args, parser=None):
     # it, in case external libraries are only available via current
     # PYTHONPATH.  (In particular, the Subversion bindings on OS X
     # are in /opt/subversion.)
     oldpypath = os.environ.get(IMPL_PATH)
     if oldpypath:
         pypath.append(oldpypath)
     os.environ[IMPL_PATH] = os.pathsep.join(pypath)
 
-    COVERAGE_FILE = os.path.join(runner.testdir, ".coverage")
+    runner.coveragefile = os.path.join(runner.testdir, ".coverage")
 
     vlog("# Using TESTDIR", runner.testdir)
     vlog("# Using HGTMP", runner.hgtmp)
     vlog("# Using PATH", os.environ["PATH"])
     vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
 
     try:
         return runtests(runner, options, tests) or 0