Commit 40955fec authored by Stefan Behnel's avatar Stefan Behnel

fix coverage analysis in test runner

parent f9baac12
...@@ -242,6 +242,11 @@ if __name__ == '__main__': ...@@ -242,6 +242,11 @@ if __name__ == '__main__':
options, cmd_args = parser.parse_args() options, cmd_args = parser.parse_args()
if options.coverage:
import coverage
coverage.erase()
coverage.start()
WITH_CYTHON = options.with_cython WITH_CYTHON = options.with_cython
if WITH_CYTHON: if WITH_CYTHON:
...@@ -250,11 +255,6 @@ if __name__ == '__main__': ...@@ -250,11 +255,6 @@ if __name__ == '__main__':
default_options as pyrex_default_options, \ default_options as pyrex_default_options, \
compile as cython_compile compile as cython_compile
from distutils.dist import Distribution
from distutils.core import Extension
from distutils.command.build_ext import build_ext
distutils_distro = Distribution()
# RUN ALL TESTS! # RUN ALL TESTS!
ROOTDIR = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'tests') ROOTDIR = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'tests')
WORKDIR = os.path.join(os.getcwd(), 'BUILD') WORKDIR = os.path.join(os.getcwd(), 'BUILD')
...@@ -277,17 +277,10 @@ if __name__ == '__main__': ...@@ -277,17 +277,10 @@ if __name__ == '__main__':
if not selectors: if not selectors:
selectors = [ lambda x:True ] selectors = [ lambda x:True ]
if options.coverage:
import coverage
coverage.erase()
tests = TestBuilder(ROOTDIR, WORKDIR, selectors, tests = TestBuilder(ROOTDIR, WORKDIR, selectors,
options.annotate_source, options.cleanup_workdir) options.annotate_source, options.cleanup_workdir)
test_suite = tests.build_suite() test_suite = tests.build_suite()
if options.coverage:
coverage.start()
unittest.TextTestRunner(verbosity=options.verbosity).run(test_suite) unittest.TextTestRunner(verbosity=options.verbosity).run(test_suite)
if options.coverage: if options.coverage:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment