summaryrefslogtreecommitdiff
path: root/tests/farm
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-08-31 07:51:51 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-08-31 07:51:51 -0400
commit5164d566f03894f0fe9f29dc4e9721edfdf32818 (patch)
treeb111451d253cdd48500fce07c844d6aced8fedc0 /tests/farm
parent0c895c59e72c7972533a32add7a771b745fa2089 (diff)
downloadpython-coveragepy-git-5164d566f03894f0fe9f29dc4e9721edfdf32818.tar.gz
Convert farm html tests to goldtests.
Diffstat (limited to 'tests/farm')
-rw-r--r--tests/farm/html/run_a.py29
-rw-r--r--tests/farm/html/run_a_xml_1.py25
-rw-r--r--tests/farm/html/run_a_xml_2.py25
-rw-r--r--tests/farm/html/run_b_branch.py32
-rw-r--r--tests/farm/html/run_bom.py24
-rw-r--r--tests/farm/html/run_isolatin1.py24
-rw-r--r--tests/farm/html/run_omit_1.py15
-rw-r--r--tests/farm/html/run_omit_2.py15
-rw-r--r--tests/farm/html/run_omit_3.py15
-rw-r--r--tests/farm/html/run_omit_4.py15
-rw-r--r--tests/farm/html/run_omit_5.py15
-rw-r--r--tests/farm/html/run_other.py29
-rw-r--r--tests/farm/html/run_partial.py34
-rw-r--r--tests/farm/html/run_styled.py31
-rw-r--r--tests/farm/html/run_tabbed.py27
-rw-r--r--tests/farm/html/run_unicode.py27
-rw-r--r--tests/farm/html/run_y_xml_branch.py25
-rw-r--r--tests/farm/html/src/omit5.ini2
-rw-r--r--tests/farm/html/src/run_a_xml_2.ini2
19 files changed, 2 insertions, 409 deletions
diff --git a/tests/farm/html/run_a.py b/tests/farm/html/run_a.py
deleted file mode 100644
index 1ec6220f..00000000
--- a/tests/farm/html/run_a.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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 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_a")
-
-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_a", "html_a", size_within=10, file_pattern="*.html")
-contains("html_a/a_py.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>',
- '<span class="pc_cov">67%</span>'
- )
-contains("html_a/index.html",
- '<a href="a_py.html">a.py</a>',
- '<span class="pc_cov">67%</span>',
- '<td class="right" data-ratio="2 3">67%</td>',
- )
-
-clean("html_a")
diff --git a/tests/farm/html/run_a_xml_1.py b/tests/farm/html/run_a_xml_1.py
deleted file mode 100644
index 5bf2f460..00000000
--- a/tests/farm/html/run_a_xml_1.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-
-source_path = None
-
-def html_it():
- """Run coverage.py and make an XML report for a."""
- import coverage, coverage.files
- cov = coverage.Coverage()
- cov.start()
- import a # pragma: nested
- cov.stop() # pragma: nested
- cov.xml_report(a, outfile="../xml_1/coverage.xml")
- global source_path
- source_path = coverage.files.relative_directory().rstrip('/')
-
-runfunc(html_it, rundir="src")
-
-compare("gold_x_xml", "xml_1", scrubs=[
- (r' timestamp="\d+"', ' timestamp="TIMESTAMP"'),
- (r' version="[-.\w]+"', ' version="VERSION"'),
- (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % source_path),
- (r'/coverage.readthedocs.org/?[-.\w/]*', '/coverage.readthedocs.org/VER'),
- ])
-clean("xml_1")
diff --git a/tests/farm/html/run_a_xml_2.py b/tests/farm/html/run_a_xml_2.py
deleted file mode 100644
index 5d8778f3..00000000
--- a/tests/farm/html/run_a_xml_2.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-
-source_path = None
-
-def html_it():
- """Run coverage.py and make an XML report for a."""
- import coverage, coverage.files
- cov = coverage.Coverage(config_file="run_a_xml_2.ini")
- cov.start()
- import a # pragma: nested
- cov.stop() # pragma: nested
- cov.xml_report(a)
- global source_path
- source_path = coverage.files.relative_directory().rstrip('/')
-
-runfunc(html_it, rundir="src")
-
-compare("gold_x_xml", "xml_2", scrubs=[
- (r' timestamp="\d+"', ' timestamp="TIMESTAMP"'),
- (r' version="[-.\w]+"', ' version="VERSION"'),
- (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % source_path),
- (r'/coverage.readthedocs.org/?[-.\w/]*', '/coverage.readthedocs.org/VER'),
- ])
-clean("xml_2")
diff --git a/tests/farm/html/run_b_branch.py b/tests/farm/html/run_b_branch.py
deleted file mode 100644
index 382e3110..00000000
--- a/tests/farm/html/run_b_branch.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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",
- '<span class="key">if</span> <span class="nam">x</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">70%</span>',
- '<span class="annotate" title="Line 8 was executed, but never jumped to line 11">8&#x202F;&#x219B;&#x202F;11 [?]</span>',
- '<span class="annotate" title="Line 17 was executed, but never jumped to the function exit">17&#x202F;&#x219B;&#x202F;exit [?]</span>',
- '<span class="annotate" title="Line 25 was executed, but never jumped to line 26 or line 28">25&#x202F;&#x219B;&#x202F;26,&nbsp;&nbsp; 25&#x202F;&#x219B;&#x202F;28 [?]</span>',
- )
-contains("html_b_branch/index.html",
- '<a href="b_py.html">b.py</a>',
- '<span class="pc_cov">70%</span>',
- '<td class="right" data-ratio="16 23">70%</td>',
- )
-
-clean("html_b_branch")
diff --git a/tests/farm/html/run_bom.py b/tests/farm/html/run_bom.py
deleted file mode 100644
index a34fab9f..00000000
--- a/tests/farm/html/run_bom.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-
-import sys
-
-def html_it():
- """Run coverage.py and make an HTML report for bom.py."""
- import coverage
- cov = coverage.Coverage()
- cov.start()
- import bom # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(bom, directory="../html_bom")
-
-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_bom", "html_bom", size_within=10, file_pattern="*.html")
-contains("html_bom/bom_py.html",
- '<span class="str">&quot;3&#215;4 = 12, &#247;2 = 6&#177;0&quot;</span>',
- )
-
-clean("html_bom")
diff --git a/tests/farm/html/run_isolatin1.py b/tests/farm/html/run_isolatin1.py
deleted file mode 100644
index 6729a275..00000000
--- a/tests/farm/html/run_isolatin1.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-
-import sys
-
-def html_it():
- """Run coverage.py and make an HTML report for isolatin1.py."""
- import coverage
- cov = coverage.Coverage()
- cov.start()
- import isolatin1 # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(isolatin1, directory="../html_isolatin1")
-
-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_isolatin1", "html_isolatin1", size_within=10, file_pattern="*.html")
-contains("html_isolatin1/isolatin1_py.html",
- '<span class="str">&quot;3&#215;4 = 12, &#247;2 = 6&#177;0&quot;</span>',
- )
-
-clean("html_isolatin1")
diff --git a/tests/farm/html/run_omit_1.py b/tests/farm/html/run_omit_1.py
deleted file mode 100644
index 137d37ca..00000000
--- a/tests/farm/html/run_omit_1.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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 and make an HTML report for main."""
- import coverage
- cov = coverage.Coverage(include=["./*"])
- cov.start()
- import main # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(directory="../html_omit_1")
-
-runfunc(html_it, rundir="src")
-compare("gold_omit_1", "html_omit_1", size_within=10, file_pattern="*.html")
-clean("html_omit_1")
diff --git a/tests/farm/html/run_omit_2.py b/tests/farm/html/run_omit_2.py
deleted file mode 100644
index dd021b96..00000000
--- a/tests/farm/html/run_omit_2.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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 and make an HTML report for main."""
- import coverage
- cov = coverage.Coverage(include=["./*"])
- cov.start()
- import main # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(directory="../html_omit_2", omit=["m1.py"])
-
-runfunc(html_it, rundir="src")
-compare("gold_omit_2", "html_omit_2", size_within=10, file_pattern="*.html")
-clean("html_omit_2")
diff --git a/tests/farm/html/run_omit_3.py b/tests/farm/html/run_omit_3.py
deleted file mode 100644
index 96ed0822..00000000
--- a/tests/farm/html/run_omit_3.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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 and make an HTML report for main."""
- import coverage
- cov = coverage.Coverage(include=["./*"])
- cov.start()
- import main # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(directory="../html_omit_3", omit=["m1.py", "m2.py"])
-
-runfunc(html_it, rundir="src")
-compare("gold_omit_3", "html_omit_3", size_within=10, file_pattern="*.html")
-clean("html_omit_3")
diff --git a/tests/farm/html/run_omit_4.py b/tests/farm/html/run_omit_4.py
deleted file mode 100644
index b212ef40..00000000
--- a/tests/farm/html/run_omit_4.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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 and make an HTML report for main."""
- import coverage
- cov = coverage.Coverage(config_file="omit4.ini", include=["./*"])
- cov.start()
- import main # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(directory="../html_omit_4")
-
-runfunc(html_it, rundir="src")
-compare("gold_omit_4", "html_omit_4", size_within=10, file_pattern="*.html")
-clean("html_omit_4")
diff --git a/tests/farm/html/run_omit_5.py b/tests/farm/html/run_omit_5.py
deleted file mode 100644
index ed61d209..00000000
--- a/tests/farm/html/run_omit_5.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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 and make an HTML report for main."""
- import coverage
- cov = coverage.Coverage(config_file="omit5.ini", include=["./*"])
- cov.start()
- import main # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report()
-
-runfunc(html_it, rundir="src")
-compare("gold_omit_5", "html_omit_5", size_within=10, file_pattern="*.html")
-clean("html_omit_5")
diff --git a/tests/farm/html/run_other.py b/tests/farm/html/run_other.py
deleted file mode 100644
index 92753d4b..00000000
--- a/tests/farm/html/run_other.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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 and make an HTML report for everything."""
- import coverage
- cov = coverage.Coverage(include=["./*", "../othersrc/*"])
- cov.start()
- import here # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(directory="../html_other")
-
-runfunc(html_it, rundir="src", addtopath="../othersrc")
-
-# Different platforms will name the "other" file differently. Rename it
-import os, glob
-
-for p in glob.glob("html_other/*_other_py.html"):
- os.rename(p, "html_other/blah_blah_other_py.html")
-
-# HTML files will change often. Check that the sizes are reasonable,
-# and check that certain key strings are in the output.
-compare("gold_other", "html_other", size_within=10, file_pattern="*.html")
-contains("html_other/index.html",
- '<a href="here_py.html">here.py</a>',
- 'other_py.html">', 'other.py</a>',
- )
-
-clean("html_other")
diff --git a/tests/farm/html/run_partial.py b/tests/farm/html/run_partial.py
deleted file mode 100644
index fedf7082..00000000
--- a/tests/farm/html/run_partial.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-
-import sys
-
-def html_it():
- """Run coverage.py and make an HTML report for partial."""
- import coverage
- cov = coverage.Coverage(branch=True)
- cov.start()
- import partial # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(partial, directory="../html_partial")
-
-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_partial", "html_partial", size_within=10, file_pattern="*.html")
-contains("html_partial/partial_py.html",
- '<p id="t8" class="stm run hide_run">',
- '<p id="t11" class="stm run hide_run">',
- '<p id="t14" class="stm run hide_run">',
- # The "if 0" and "if 1" statements are optimized away.
- '<p id="t17" class="pln">',
- )
-contains("html_partial/index.html",
- '<a href="partial_py.html">partial.py</a>',
- )
-contains("html_partial/index.html",
- '<span class="pc_cov">100%</span>'
- )
-
-clean("html_partial")
diff --git a/tests/farm/html/run_styled.py b/tests/farm/html/run_styled.py
deleted file mode 100644
index eeebfe61..00000000
--- a/tests/farm/html/run_styled.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# 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 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",
- '<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_py.html">a.py</a>',
- '<span class="pc_cov">67%</span>'
- )
-
-clean("html_styled")
diff --git a/tests/farm/html/run_tabbed.py b/tests/farm/html/run_tabbed.py
deleted file mode 100644
index 6dacff53..00000000
--- a/tests/farm/html/run_tabbed.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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 and make an HTML report for tabbed."""
- import coverage
- cov = coverage.Coverage()
- cov.start()
- import tabbed # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(tabbed, directory="../html_tabbed")
-
-runfunc(html_it, rundir="src")
-
-# Editors like to change things, make sure our source file still has tabs.
-contains("src/tabbed.py", "\tif x:\t\t\t\t\t# look nice")
-
-contains("html_tabbed/tabbed_py.html",
- '>&nbsp; &nbsp; &nbsp; &nbsp; <span class="key">if</span> '
- '<span class="nam">x</span><span class="op">:</span>'
- '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '
- '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; '
- '<span class="com"># look nice</span>'
- )
-
-doesnt_contain("html_tabbed/tabbed_py.html", "\t")
-clean("html_tabbed")
diff --git a/tests/farm/html/run_unicode.py b/tests/farm/html/run_unicode.py
deleted file mode 100644
index 888d7e54..00000000
--- a/tests/farm/html/run_unicode.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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 and make an HTML report for unicode.py."""
- import coverage
- cov = coverage.Coverage()
- cov.start()
- import unicode # pragma: nested
- cov.stop() # pragma: nested
- cov.html_report(unicode, directory="../html_unicode")
-
-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_unicode", "html_unicode", size_within=10, file_pattern="*.html")
-contains("html_unicode/unicode_py.html",
- '<span class="str">&quot;&#654;d&#729;&#477;b&#592;&#633;&#477;&#652;o&#596;&quot;</span>',
- )
-
-contains_any("html_unicode/unicode_py.html",
- '<span class="str">&quot;db40,dd00: x&#56128;&#56576;&quot;</span>',
- '<span class="str">&quot;db40,dd00: x&#917760;&quot;</span>',
- )
-
-clean("html_unicode")
diff --git a/tests/farm/html/run_y_xml_branch.py b/tests/farm/html/run_y_xml_branch.py
deleted file mode 100644
index 921da9e2..00000000
--- a/tests/farm/html/run_y_xml_branch.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
-
-source_path = None
-
-def xml_it():
- """Run coverage.py and make an XML report for y."""
- import coverage, coverage.files
- cov = coverage.Coverage(branch=True)
- cov.start()
- import y # pragma: nested
- cov.stop() # pragma: nested
- cov.xml_report(y, outfile="../xml_branch/coverage.xml")
- global source_path
- source_path = coverage.files.relative_directory().rstrip('/')
-
-runfunc(xml_it, rundir="src")
-
-compare("gold_y_xml_branch", "xml_branch", scrubs=[
- (r' timestamp="\d+"', ' timestamp="TIMESTAMP"'),
- (r' version="[-.\w]+"', ' version="VERSION"'),
- (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % source_path),
- (r'/coverage.readthedocs.org/?[-.\w/]*', '/coverage.readthedocs.org/VER'),
- ])
-clean("xml_branch")
diff --git a/tests/farm/html/src/omit5.ini b/tests/farm/html/src/omit5.ini
index 3d8dbcf2..3b6add29 100644
--- a/tests/farm/html/src/omit5.ini
+++ b/tests/farm/html/src/omit5.ini
@@ -8,4 +8,4 @@ omit =
helloworld
[html]
-directory = ../html_omit_5
+directory = ../out/omit_5
diff --git a/tests/farm/html/src/run_a_xml_2.ini b/tests/farm/html/src/run_a_xml_2.ini
index 5b5f18dc..f632bd09 100644
--- a/tests/farm/html/src/run_a_xml_2.ini
+++ b/tests/farm/html/src/run_a_xml_2.ini
@@ -3,4 +3,4 @@
# Put all the XML output in xml_2
[xml]
-output = ../xml_2/coverage.xml
+output = ../out/xml_2/coverage.xml