summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2015-02-22 11:41:49 +0100
committerStefan Behnel <stefan_ml@behnel.de>2015-02-22 11:41:49 +0100
commit429f4add1eb23693d4229b19a0d12ab8331b2502 (patch)
treee0fa3d51a3347002d00efe6efdefec7ade917a30 /test.py
parentbf67db2fac92c476af15273f84ca23b91ff91822 (diff)
downloadpython-lxml-429f4add1eb23693d4229b19a0d12ab8331b2502.tar.gz
exclude test modules from coverage reporting
Diffstat (limited to 'test.py')
-rw-r--r--test.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/test.py b/test.py
index af938c3b..fd3747df 100644
--- a/test.py
+++ b/test.py
@@ -550,7 +550,7 @@ def main(argv):
cov = None
if cfg.run_tests and cfg.coverage:
from coverage import coverage
- cov = coverage()
+ cov = coverage(omit=['test.py'])
# Finding and importing
test_files = get_test_files(cfg)
@@ -591,17 +591,20 @@ def main(argv):
if cov is not None:
traced_file_types = ('.py', '.pyx', '.pxi', '.pxd')
modules = []
- if cfg.follow_symlinks:
- walker = walk_with_symlinks
- else:
- walker = os.path.walk
def add_file(_, path, files):
+ if 'tests' in os.path.relpath(path, cfg.basedir).split(os.sep):
+ return
for filename in files:
if filename.endswith(traced_file_types):
modules.append(os.path.join(path, filename))
+ if cfg.follow_symlinks:
+ walker = walk_with_symlinks
+ else:
+ walker = os.path.walk
walker(os.path.abspath(cfg.basedir), add_file, None)
+
try:
cov.xml_report(modules, outfile='coverage.xml')
if cfg.coverdir: