summaryrefslogtreecommitdiff
path: root/test/farm/html/run_styled.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-04-20 17:37:11 -0400
committerNed Batchelder <ned@nedbatchelder.com>2012-04-20 17:37:11 -0400
commit78e2c8c6e014b205e5f2cf7764ca9cf3597b318a (patch)
tree99dcb9b259c8c343e1623c705dda50201b7b0d82 /test/farm/html/run_styled.py
parent886c61c219b68dd66103a8c05f96ae9bf6b82ad6 (diff)
downloadpython-coveragepy-git-78e2c8c6e014b205e5f2cf7764ca9cf3597b318a.tar.gz
The [html]extra_css configuration value is a file path to a CSS file that gets copied into the HTML report.
Diffstat (limited to 'test/farm/html/run_styled.py')
-rw-r--r--test/farm/html/run_styled.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/farm/html/run_styled.py b/test/farm/html/run_styled.py
new file mode 100644
index 00000000..3a212957
--- /dev/null
+++ b/test/farm/html/run_styled.py
@@ -0,0 +1,28 @@
+def html_it():
+ """Run coverage and make an HTML report for a."""
+ import coverage
+ cov = coverage.coverage()
+ cov.start()
+ import a
+ cov.stop()
+ 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.html",
+ "<link rel='stylesheet' href='extra.css' type='text/css'>",
+ "<span class='key'>if</span> <span class='num'>1</span> <span class='op'>&lt;</span> <span class='num'>2</span>",
+ "&nbsp; &nbsp; <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span>",
+ "<span class='pc_cov'>67%</span>"
+ )
+contains("html_styled/index.html",
+ "<link rel='stylesheet' href='extra.css' type='text/css'>",
+ "<a href='a.html'>a</a>",
+ "<span class='pc_cov'>67%</span>"
+ )
+
+clean("html_styled")