Show More
@@ -1985,27 +1985,27 b' class TestRunner(object):' | |||||
1985 |
|
1985 | |||
1986 | def _outputcoverage(self): |
|
1986 | def _outputcoverage(self): | |
1987 | """Produce code coverage output.""" |
|
1987 | """Produce code coverage output.""" | |
1988 |
|
|
1988 | from coverage import coverage | |
1989 | os.chdir(self._pythondir) |
|
|||
1990 |
|
1989 | |||
1991 | def covrun(*args): |
|
1990 | vlog('# Producing coverage report') | |
1992 | cmd = 'coverage %s' % ' '.join(args) |
|
1991 | # chdir is the easiest way to get short, relative paths in the | |
1993 | vlog('# Running: %s' % cmd) |
|
1992 | # output. | |
1994 | os.system(cmd) |
|
1993 | os.chdir(self._pythondir) | |
|
1994 | covdir = os.path.join(self._installdir, '..') | |||
|
1995 | cov = coverage(data_file=os.path.join(covdir, '.coverage')) | |||
|
1996 | cov.load() | |||
1995 |
|
1997 | |||
1996 | covrun('-c') |
|
1998 | omit = [os.path.join(x, '*') for x in [self._bindir, self._testdir]] | |
1997 | omit = ','.join(os.path.join(x, '*') for x in |
|
1999 | cov.report(ignore_errors=True, omit=omit) | |
1998 | [self._bindir, self._testdir]) |
|
2000 | ||
1999 | covrun('-i', '-r', '"--omit=%s"' % omit) # report |
|
|||
2000 | if self.options.htmlcov: |
|
2001 | if self.options.htmlcov: | |
2001 | htmldir = os.path.join(self._testdir, 'htmlcov') |
|
2002 | htmldir = os.path.join(self._testdir, 'htmlcov') | |
2002 | covrun('-i', '-b', '"--directory=%s"' % htmldir, |
|
2003 | cov.html_report(directory=htmldir, omit=omit) | |
2003 | '"--omit=%s"' % omit) |
|
|||
2004 | if self.options.annotate: |
|
2004 | if self.options.annotate: | |
2005 | adir = os.path.join(self._testdir, 'annotated') |
|
2005 | adir = os.path.join(self._testdir, 'annotated') | |
2006 | if not os.path.isdir(adir): |
|
2006 | if not os.path.isdir(adir): | |
2007 | os.mkdir(adir) |
|
2007 | os.mkdir(adir) | |
2008 |
cov |
|
2008 | cov.annotate(directory=adir, omit=omit) | |
2009 |
|
2009 | |||
2010 | def _findprogram(self, program): |
|
2010 | def _findprogram(self, program): | |
2011 | """Search PATH for a executable program""" |
|
2011 | """Search PATH for a executable program""" |
General Comments 0
You need to be logged in to leave comments.
Login now