Adjust check_coverage.py for coverage 4.0.

This commit is contained in:
Florian Bruhin 2015-09-21 07:42:10 +02:00
parent cbc0721906
commit 311ae78bc3
2 changed files with 2 additions and 7 deletions

View File

@ -120,12 +120,7 @@ def check(fileobj, perfect_files):
assert 0 <= branch_cov <= 100, branch_cov
assert '\\' not in filename, filename
# Files without any branches have 0% coverage
has_branches = klass.find('./lines/line[@branch="true"]') is not None
if branch_cov < 100 and has_branches:
is_bad = True
else:
is_bad = line_cov < 100
is_bad = line_cov < 100 or branch_cov < 100
if filename in perfect_files and is_bad:
messages.append(("{} has {}% line and {}% branch coverage!".format(

View File

@ -126,7 +126,7 @@ def test_untested(covtest):
pass
""")
covtest.run()
expected = 'module.py has 75.0% line and 0.0% branch coverage!'
expected = 'module.py has 75.0% line and 100.0% branch coverage!'
assert covtest.check() == [expected]