1949 vlog('# Installing coverage trigger to %s' % target) |
1949 vlog('# Installing coverage trigger to %s' % target) |
1950 shutil.copyfile(custom, target) |
1950 shutil.copyfile(custom, target) |
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 |
1959 the one we expect it to be. If not, print a warning to stderr.""" |
1965 the one we expect it to be. If not, print a warning to stderr.""" |
1960 if ((self._bindir == self._pythondir) and |
1966 if ((self._bindir == self._pythondir) and |
1989 |
1995 |
1990 vlog('# Producing coverage report') |
1996 vlog('# Producing coverage report') |
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) |
2000 |
2006 |
2001 if self.options.htmlcov: |
2007 if self.options.htmlcov: |