139 parser.add_option("-d", "--debug", action="store_true", |
139 parser.add_option("-d", "--debug", action="store_true", |
140 help="debug mode: write output of test scripts to console" |
140 help="debug mode: write output of test scripts to console" |
141 " rather than capturing and diff'ing it (disables timeout)") |
141 " rather than capturing and diff'ing it (disables timeout)") |
142 parser.add_option("-f", "--first", action="store_true", |
142 parser.add_option("-f", "--first", action="store_true", |
143 help="exit on the first test failure") |
143 help="exit on the first test failure") |
|
144 parser.add_option("-H", "--htmlcov", action="store_true", |
|
145 help="create an HTML report of the coverage of the files") |
144 parser.add_option("--inotify", action="store_true", |
146 parser.add_option("--inotify", action="store_true", |
145 help="enable inotify extension when running tests") |
147 help="enable inotify extension when running tests") |
146 parser.add_option("-i", "--interactive", action="store_true", |
148 parser.add_option("-i", "--interactive", action="store_true", |
147 help="prompt to accept changed output") |
149 help="prompt to accept changed output") |
148 parser.add_option("-j", "--jobs", type="int", |
150 parser.add_option("-j", "--jobs", type="int", |
209 if not os.access(hgbin, os.X_OK): |
211 if not os.access(hgbin, os.X_OK): |
210 parser.error('--local specified, but %r not found or not executable' |
212 parser.error('--local specified, but %r not found or not executable' |
211 % hgbin) |
213 % hgbin) |
212 options.with_hg = hgbin |
214 options.with_hg = hgbin |
213 |
215 |
214 options.anycoverage = options.cover or options.annotate |
216 options.anycoverage = options.cover or options.annotate or options.htmlcov |
215 if options.anycoverage: |
217 if options.anycoverage: |
216 try: |
218 try: |
217 import coverage |
219 import coverage |
218 covver = version.StrictVersion(coverage.__version__).version |
220 covver = version.StrictVersion(coverage.__version__).version |
219 if covver < (3, 3): |
221 if covver < (3, 3): |
493 return |
495 return |
494 |
496 |
495 covrun('-c') |
497 covrun('-c') |
496 omit = ','.join(os.path.join(x, '*') for x in [BINDIR, TESTDIR]) |
498 omit = ','.join(os.path.join(x, '*') for x in [BINDIR, TESTDIR]) |
497 covrun('-i', '-r', '"--omit=%s"' % omit) # report |
499 covrun('-i', '-r', '"--omit=%s"' % omit) # report |
|
500 if options.htmlcov: |
|
501 htmldir = os.path.join(TESTDIR, 'htmlcov') |
|
502 covrun('-i', '-b', '"--directory=%s"' % htmldir, '"--omit=%s"' % omit) |
498 if options.annotate: |
503 if options.annotate: |
499 adir = os.path.join(TESTDIR, 'annotated') |
504 adir = os.path.join(TESTDIR, 'annotated') |
500 if not os.path.isdir(adir): |
505 if not os.path.isdir(adir): |
501 os.mkdir(adir) |
506 os.mkdir(adir) |
502 covrun('-i', '-a', '"--directory=%s"' % adir, '"--omit=%s"' % omit) |
507 covrun('-i', '-a', '"--directory=%s"' % adir, '"--omit=%s"' % omit) |