# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt def html_it(): """Run coverage.py with branches and make an HTML report for b.""" import coverage cov = coverage.Coverage(branch=True) cov.start() import b # pragma: nested cov.stop() # pragma: nested cov.html_report(b, directory="../html_b_branch") runfunc(html_it, rundir="src") # HTML files will change often. Check that the sizes are reasonable, # and check that certain key strings are in the output. compare("gold_b_branch", "html_b_branch", size_within=10, file_pattern="*.html") contains("html_b_branch/b_py.html", 'if x < 2', '    a = 3', '70%', '8 ↛ 11 [?]', '17 ↛ exit [?]', '25 ↛ 26,   25 ↛ 28 [?]', ) contains("html_b_branch/index.html", 'b.py', '70%', '70%', ) clean("html_b_branch")