diff -r 031947baf4d0 -r 60bbb4079c28 tests/run-tests.py --- a/tests/run-tests.py Sat Mar 28 00:47:58 2015 -0700 +++ b/tests/run-tests.py Sat Mar 28 00:21:30 2015 -0700 @@ -260,6 +260,10 @@ parser.error("sorry, coverage options do not work when --local " "is specified") + if options.anycoverage and options.with_hg: + parser.error("sorry, coverage options do not work when --with-hg " + "is specified") + global verbose if options.verbose: verbose = '' @@ -1567,6 +1571,7 @@ def __init__(self): self.options = None + self._hgroot = None self._testdir = None self._hgtmp = None self._installdir = None @@ -1872,6 +1877,7 @@ # Run installer in hg root script = os.path.realpath(sys.argv[0]) hgroot = os.path.dirname(os.path.dirname(script)) + self._hgroot = hgroot os.chdir(hgroot) nohome = '--home=""' if os.name == 'nt': @@ -1996,9 +2002,13 @@ vlog('# Producing coverage report') # chdir is the easiest way to get short, relative paths in the # output. - os.chdir(self._pythondir) + os.chdir(self._hgroot) covdir = os.path.join(self._installdir, '..', 'coverage') cov = coverage(data_file=os.path.join(covdir, 'cov')) + + # Map install directory paths back to source directory. + cov.config.paths['srcdir'] = ['.', self._pythondir] + cov.combine() omit = [os.path.join(x, '*') for x in [self._bindir, self._testdir]]