def html_it(): """Run coverage and make an HTML report for a.""" import coverage cov = coverage.coverage() cov.start() import a # pragma: nested cov.stop() # pragma: nested cov.html_report(a, directory="../html_styled", extra_css="extra.css") 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_styled", "html_styled", size_within=10, file_pattern="*.html") compare("gold_styled", "html_styled", size_within=10, file_pattern="*.css") contains("html_styled/a_py.html", '', 'if 1 < 2', '    a = 3', '67%' ) contains("html_styled/index.html", '', 'a.py', '67%' ) clean("html_styled")