Show More
@@ -386,29 +386,6 b' def killdaemons(pidfile):' | |||||
386 | return killmod.killdaemons(pidfile, tryhard=False, remove=True, |
|
386 | return killmod.killdaemons(pidfile, tryhard=False, remove=True, | |
387 | logfn=vlog) |
|
387 | logfn=vlog) | |
388 |
|
388 | |||
389 | def outputcoverage(runner): |
|
|||
390 |
|
||||
391 | vlog('# Producing coverage report') |
|
|||
392 | os.chdir(runner.pythondir) |
|
|||
393 |
|
||||
394 | def covrun(*args): |
|
|||
395 | cmd = 'coverage %s' % ' '.join(args) |
|
|||
396 | vlog('# Running: %s' % cmd) |
|
|||
397 | os.system(cmd) |
|
|||
398 |
|
||||
399 | covrun('-c') |
|
|||
400 | omit = ','.join(os.path.join(x, '*') for x in |
|
|||
401 | [runner.bindir, runner.testdir]) |
|
|||
402 | covrun('-i', '-r', '"--omit=%s"' % omit) # report |
|
|||
403 | if runner.options.htmlcov: |
|
|||
404 | htmldir = os.path.join(runner.testdir, 'htmlcov') |
|
|||
405 | covrun('-i', '-b', '"--directory=%s"' % htmldir, '"--omit=%s"' % omit) |
|
|||
406 | if runner.options.annotate: |
|
|||
407 | adir = os.path.join(runner.testdir, 'annotated') |
|
|||
408 | if not os.path.isdir(adir): |
|
|||
409 | os.mkdir(adir) |
|
|||
410 | covrun('-i', '-a', '"--directory=%s"' % adir, '"--omit=%s"' % omit) |
|
|||
411 |
|
||||
412 | class Test(object): |
|
389 | class Test(object): | |
413 | """Encapsulates a single, runnable test. |
|
390 | """Encapsulates a single, runnable test. | |
414 |
|
391 | |||
@@ -1121,7 +1098,7 b' def runtests(runner, tests):' | |||||
1121 | runner.outputtimes() |
|
1098 | runner.outputtimes() | |
1122 |
|
1099 | |||
1123 | if runner.options.anycoverage: |
|
1100 | if runner.options.anycoverage: | |
1124 |
outputcoverage( |
|
1101 | runner.outputcoverage() | |
1125 | except KeyboardInterrupt: |
|
1102 | except KeyboardInterrupt: | |
1126 | failed = True |
|
1103 | failed = True | |
1127 | print "\ninterrupted!" |
|
1104 | print "\ninterrupted!" | |
@@ -1301,6 +1278,29 b' class TestRunner(object):' | |||||
1301 | for test, timetaken in times: |
|
1278 | for test, timetaken in times: | |
1302 | print cols % (timetaken, test) |
|
1279 | print cols % (timetaken, test) | |
1303 |
|
1280 | |||
|
1281 | def outputcoverage(self): | |||
|
1282 | vlog('# Producing coverage report') | |||
|
1283 | os.chdir(self.pythondir) | |||
|
1284 | ||||
|
1285 | def covrun(*args): | |||
|
1286 | cmd = 'coverage %s' % ' '.join(args) | |||
|
1287 | vlog('# Running: %s' % cmd) | |||
|
1288 | os.system(cmd) | |||
|
1289 | ||||
|
1290 | covrun('-c') | |||
|
1291 | omit = ','.join(os.path.join(x, '*') for x in | |||
|
1292 | [self.bindir, self.testdir]) | |||
|
1293 | covrun('-i', '-r', '"--omit=%s"' % omit) # report | |||
|
1294 | if self.options.htmlcov: | |||
|
1295 | htmldir = os.path.join(self.testdir, 'htmlcov') | |||
|
1296 | covrun('-i', '-b', '"--directory=%s"' % htmldir, | |||
|
1297 | '"--omit=%s"' % omit) | |||
|
1298 | if self.options.annotate: | |||
|
1299 | adir = os.path.join(self.testdir, 'annotated') | |||
|
1300 | if not os.path.isdir(adir): | |||
|
1301 | os.mkdir(adir) | |||
|
1302 | covrun('-i', '-a', '"--directory=%s"' % adir, '"--omit=%s"' % omit) | |||
|
1303 | ||||
1304 | def main(args, parser=None): |
|
1304 | def main(args, parser=None): | |
1305 | runner = TestRunner() |
|
1305 | runner = TestRunner() | |
1306 |
|
1306 |
General Comments 0
You need to be logged in to leave comments.
Login now