summaryrefslogtreecommitdiff
path: root/test/farm
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-09-23 22:11:47 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-09-23 22:11:47 -0400
commite44f649ad61d6a7e717931628d2476284402484b (patch)
tree9a70873264cc7832e1156eaac5626f3ff6652408 /test/farm
parentc0f54c80150b65d650e85339e98c17d025625d24 (diff)
downloadpython-coveragepy-git-e44f649ad61d6a7e717931628d2476284402484b.tar.gz
Get the test working properly, including adding a usable diff comparison when tests fail. Also make it all work under Py3k.
Diffstat (limited to 'test/farm')
-rw-r--r--test/farm/html/gold_x_xml/coverage.xml (renamed from test/farm/html/gold_a_xml/coverage.xml)2
-rw-r--r--test/farm/html/run_a.py2
-rw-r--r--test/farm/html/run_x_xml.py (renamed from test/farm/html/run_a_xml.py)8
-rw-r--r--test/farm/html/src/x.py7
4 files changed, 13 insertions, 6 deletions
diff --git a/test/farm/html/gold_a_xml/coverage.xml b/test/farm/html/gold_x_xml/coverage.xml
index 9c67a55c..510590ac 100644
--- a/test/farm/html/gold_a_xml/coverage.xml
+++ b/test/farm/html/gold_x_xml/coverage.xml
@@ -5,7 +5,7 @@
<packages>
<package branch-rate="0.0" complexity="0.0" line-rate="0.666666666667" name=".">
<classes>
- <class branch-rate="0.0" complexity="0.0" filename="c:\ned\coverage\trunk\test\farm\html\src\a.py" line-rate="0.666666666667" name="a">
+ <class branch-rate="0.0" complexity="0.0" filename="c:\ned\coverage\trunk\test\farm\html\src\x.py" line-rate="0.666666666667" name="x">
<lines>
<line branch="false" hits="1" number="3"/>
<line branch="false" hits="1" number="5"/>
diff --git a/test/farm/html/run_a.py b/test/farm/html/run_a.py
index 4a8a0514..dc7719a2 100644
--- a/test/farm/html/run_a.py
+++ b/test/farm/html/run_a.py
@@ -11,7 +11,7 @@ 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("html", "gold_a", size_within=10)
+compare("gold_a", "html", size_within=10)
contains("html/a.html",
"<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>",
diff --git a/test/farm/html/run_a_xml.py b/test/farm/html/run_x_xml.py
index 6df7dcd4..c1dbb163 100644
--- a/test/farm/html/run_a_xml.py
+++ b/test/farm/html/run_x_xml.py
@@ -1,11 +1,11 @@
def html_it():
- """Run coverage and make an XML report for a."""
+ """Run coverage and make an XML report for x."""
import coverage
cov = coverage.coverage()
cov.start()
- import a
+ import x
cov.stop()
- cov.xml_report(a, outfile=open("../xml/coverage.xml", 'w'))
+ cov.xml_report(x, outfile=open("../xml/coverage.xml", 'w'))
import os
if not os.path.exists("xml"):
@@ -13,5 +13,5 @@ if not os.path.exists("xml"):
runfunc(html_it, rundir="src")
-compare("xml", "gold_a_xml")
+compare("gold_x_xml", "xml")
clean("xml")
diff --git a/test/farm/html/src/x.py b/test/farm/html/src/x.py
new file mode 100644
index 00000000..9e71aebd
--- /dev/null
+++ b/test/farm/html/src/x.py
@@ -0,0 +1,7 @@
+# A test file for HTML reporting by coverage.
+
+if 1 < 2:
+ # Needed a < to look at HTML entities.
+ a = 3
+else:
+ a = 4