def html_it(): """Run coverage 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.html", "if x < 2", "    a = 3", "70%", "8", "exit", "23   25", ) contains("html_b_branch/index.html", "b", "70%" ) clean("html_b_branch")