##// END OF EJS Templates
run-tests: collect aggregate code coverage...
Gregory Szorc -
r24505:031947ba default
parent child Browse files
Show More
@@ -1951,8 +1951,14 b' class TestRunner(object):'
1951 rc = os.path.join(self._testdir, '.coveragerc')
1951 rc = os.path.join(self._testdir, '.coveragerc')
1952 vlog('# Installing coverage rc to %s' % rc)
1952 vlog('# Installing coverage rc to %s' % rc)
1953 os.environ['COVERAGE_PROCESS_START'] = rc
1953 os.environ['COVERAGE_PROCESS_START'] = rc
1954 fn = os.path.join(self._installdir, '..', '.coverage')
1954 covdir = os.path.join(self._installdir, '..', 'coverage')
1955 os.environ['COVERAGE_FILE'] = fn
1955 try:
1956 os.mkdir(covdir)
1957 except OSError, e:
1958 if e.errno != errno.EEXIST:
1959 raise
1960
1961 os.environ['COVERAGE_DIR'] = covdir
1956
1962
1957 def _checkhglib(self, verb):
1963 def _checkhglib(self, verb):
1958 """Ensure that the 'mercurial' package imported by python is
1964 """Ensure that the 'mercurial' package imported by python is
@@ -1991,9 +1997,9 b' class TestRunner(object):'
1991 # chdir is the easiest way to get short, relative paths in the
1997 # chdir is the easiest way to get short, relative paths in the
1992 # output.
1998 # output.
1993 os.chdir(self._pythondir)
1999 os.chdir(self._pythondir)
1994 covdir = os.path.join(self._installdir, '..')
2000 covdir = os.path.join(self._installdir, '..', 'coverage')
1995 cov = coverage(data_file=os.path.join(covdir, '.coverage'))
2001 cov = coverage(data_file=os.path.join(covdir, 'cov'))
1996 cov.load()
2002 cov.combine()
1997
2003
1998 omit = [os.path.join(x, '*') for x in [self._bindir, self._testdir]]
2004 omit = [os.path.join(x, '*') for x in [self._bindir, self._testdir]]
1999 cov.report(ignore_errors=True, omit=omit)
2005 cov.report(ignore_errors=True, omit=omit)
@@ -1,5 +1,16 b''
1 import os
2
3 if os.environ.get('COVERAGE_PROCESS_START'):
1 try:
4 try:
2 import coverage
5 import coverage
3 getattr(coverage, 'process_startup', lambda: None)()
6 import random
7
8 # uuid is better, but not available in Python 2.4.
9 covpath = os.path.join(os.environ['COVERAGE_DIR'],
10 'cov.%s' % random.randrange(0, 1000000000000))
11 cov = coverage.coverage(data_file=covpath, auto_data=True)
12 cov._warn_no_data = False
13 cov._warn_unimported_source = False
14 cov.start()
4 except ImportError:
15 except ImportError:
5 pass
16 pass
General Comments 0
You need to be logged in to leave comments. Login now