tests/run-tests.py
changeset 2146 eb1ed410aa34
parent 2145 5bb3cb9e5d13
child 2183 a56fc34d6e23
equal deleted inserted replaced
2145:5bb3cb9e5d13 2146:eb1ed410aa34
    90         vlog("# Installing coverage wrapper")
    90         vlog("# Installing coverage wrapper")
    91         os.environ['COVERAGE_FILE'] = COVERAGE_FILE
    91         os.environ['COVERAGE_FILE'] = COVERAGE_FILE
    92         if os.path.exists(COVERAGE_FILE):
    92         if os.path.exists(COVERAGE_FILE):
    93             os.unlink(COVERAGE_FILE)
    93             os.unlink(COVERAGE_FILE)
    94         # Create a wrapper script to invoke hg via coverage.py
    94         # Create a wrapper script to invoke hg via coverage.py
    95         os.rename(os.path.join(BINDIR, "hg"), os.path.join(BINDIR, "_hg.py")) 
    95         os.rename(os.path.join(BINDIR, "hg"), os.path.join(BINDIR, "_hg.py"))
    96         f = open(os.path.join(BINDIR, 'hg'), 'w')
    96         f = open(os.path.join(BINDIR, 'hg'), 'w')
    97         f.write('#!' + sys.executable + '\n')
    97         f.write('#!' + sys.executable + '\n')
    98         f.write('import sys, os; os.execv(sys.executable, [sys.executable, '+ \
    98         f.write('import sys, os; os.execv(sys.executable, [sys.executable, '+ \
    99             '"%s", "-x", "%s"] + sys.argv[1:])\n' % (
    99             '"%s", "-x", "%s"] + sys.argv[1:])\n' % (
   100             os.path.join(TESTDIR, 'coverage.py'),
   100             os.path.join(TESTDIR, 'coverage.py'),
   105 def output_coverage():
   105 def output_coverage():
   106     vlog("# Producing coverage report")
   106     vlog("# Producing coverage report")
   107     omit = [BINDIR, TESTDIR, PYTHONDIR]
   107     omit = [BINDIR, TESTDIR, PYTHONDIR]
   108     if not options.cover_stdlib:
   108     if not options.cover_stdlib:
   109         # Exclude as system paths (ignoring empty strings seen on win)
   109         # Exclude as system paths (ignoring empty strings seen on win)
   110         omit += [x for x in sys.path if x != '']  
   110         omit += [x for x in sys.path if x != '']
   111     omit = ','.join(omit)
   111     omit = ','.join(omit)
   112     os.chdir(PYTHONDIR)
   112     os.chdir(PYTHONDIR)
   113     cmd = '"%s" "%s" -r "--omit=%s"' % (
   113     cmd = '"%s" "%s" -r "--omit=%s"' % (
   114         sys.executable, os.path.join(TESTDIR, 'coverage.py'), omit)
   114         sys.executable, os.path.join(TESTDIR, 'coverage.py'), omit)
   115     vlog("# Running: "+cmd)
   115     vlog("# Running: "+cmd)