summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-01-17 14:55:14 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-01-17 14:55:14 -0500
commite5d90dcdabb5e9d59f6957ce92b72e36b27c3265 (patch)
treec53ac3eaf8dca2c4e808fc4fcecd07c02c07788e
parent880a71c0c26a0c22294af1859699db78711d65c0 (diff)
downloadpython-coveragepy-e5d90dcdabb5e9d59f6957ce92b72e36b27c3265.tar.gz
Use file names with extensions in reports.
-rw-r--r--CHANGES.txt8
-rw-r--r--TODO.txt1
-rw-r--r--coverage/annotate.py4
-rw-r--r--coverage/codeunit.py14
-rw-r--r--tests/farm/html/gold_a/a_py.html (renamed from tests/farm/html/gold_a/a.html)0
-rw-r--r--tests/farm/html/gold_b_branch/b_py.html (renamed from tests/farm/html/gold_b_branch/b.html)0
-rw-r--r--tests/farm/html/gold_bom/bom_py.html (renamed from tests/farm/html/gold_bom/bom.html)0
-rw-r--r--tests/farm/html/gold_isolatin1/isolatin1_py.html (renamed from tests/farm/html/gold_isolatin1/isolatin1.html)0
-rw-r--r--tests/farm/html/gold_omit_1/m1_py.html (renamed from tests/farm/html/gold_omit_1/m1.html)0
-rw-r--r--tests/farm/html/gold_omit_1/m2_py.html (renamed from tests/farm/html/gold_omit_1/m2.html)0
-rw-r--r--tests/farm/html/gold_omit_1/m3_py.html (renamed from tests/farm/html/gold_omit_1/m3.html)0
-rw-r--r--tests/farm/html/gold_omit_1/main_py.html (renamed from tests/farm/html/gold_omit_1/main.html)0
-rw-r--r--tests/farm/html/gold_omit_2/m2_py.html (renamed from tests/farm/html/gold_omit_2/m2.html)0
-rw-r--r--tests/farm/html/gold_omit_2/m3_py.html (renamed from tests/farm/html/gold_omit_2/m3.html)0
-rw-r--r--tests/farm/html/gold_omit_2/main_py.html (renamed from tests/farm/html/gold_omit_2/main.html)0
-rw-r--r--tests/farm/html/gold_omit_3/m3_py.html (renamed from tests/farm/html/gold_omit_3/m3.html)0
-rw-r--r--tests/farm/html/gold_omit_3/main_py.html (renamed from tests/farm/html/gold_omit_3/main.html)0
-rw-r--r--tests/farm/html/gold_omit_4/m1_py.html (renamed from tests/farm/html/gold_omit_4/m1.html)0
-rw-r--r--tests/farm/html/gold_omit_4/m3_py.html (renamed from tests/farm/html/gold_omit_4/m3.html)0
-rw-r--r--tests/farm/html/gold_omit_4/main_py.html (renamed from tests/farm/html/gold_omit_4/main.html)0
-rw-r--r--tests/farm/html/gold_omit_5/m1_py.html (renamed from tests/farm/html/gold_omit_5/m1.html)0
-rw-r--r--tests/farm/html/gold_omit_5/main_py.html (renamed from tests/farm/html/gold_omit_5/main.html)0
-rw-r--r--tests/farm/html/gold_other/blah_blah_other_py.html (renamed from tests/farm/html/gold_other/blah_blah_other.html)0
-rw-r--r--tests/farm/html/gold_other/here_py.html (renamed from tests/farm/html/gold_other/here.html)0
-rw-r--r--tests/farm/html/gold_partial/partial_py.html (renamed from tests/farm/html/gold_partial/partial.html)0
-rw-r--r--tests/farm/html/gold_styled/a_py.html (renamed from tests/farm/html/gold_styled/a.html)0
-rw-r--r--tests/farm/html/gold_unicode/unicode_py.html (renamed from tests/farm/html/gold_unicode/unicode.html)0
-rw-r--r--tests/farm/html/gold_x_xml/coverage.xml4
-rw-r--r--tests/farm/html/gold_y_xml_branch/coverage.xml4
-rw-r--r--tests/farm/html/run_a.py4
-rw-r--r--tests/farm/html/run_b_branch.py4
-rw-r--r--tests/farm/html/run_bom.py2
-rw-r--r--tests/farm/html/run_isolatin1.py2
-rw-r--r--tests/farm/html/run_other.py8
-rw-r--r--tests/farm/html/run_partial.py4
-rw-r--r--tests/farm/html/run_styled.py4
-rw-r--r--tests/farm/html/run_tabbed.py4
-rw-r--r--tests/farm/html/run_unicode.py4
-rw-r--r--tests/test_api.py20
-rw-r--r--tests/test_codeunit.py48
-rw-r--r--tests/test_html.py38
-rw-r--r--tests/test_process.py8
-rw-r--r--tests/test_summary.py162
43 files changed, 175 insertions, 172 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index edefb09..77ffdb9 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,11 +6,15 @@ Change history for Coverage.py
Latest
------
+- Reports now use file names with extensions. Previously, a report would
+ describe a/b/c.py as "a/b/c". Now it is shown as "a/b/c.py". This allows
+ for better support of non-Python files.
+
- Empty files are now reported as 100% covered in the XML report, not 0%
- covered, as reported in `issue 345`_.
+ covered (`issue 345`_).
- Regexes in the configuration file are now compiled as soon as they are read,
- to provide error messages earlier. `issue 349`_.
+ to provide error messages earlier (`issue 349`_).
.. _issue 345: https://bitbucket.org/ned/coveragepy/issue/345/xml-reports-line-rate-0-for-empty-files
.. _issue 349: https://bitbucket.org/ned/coveragepy/issue/349/bad-regex-in-config-should-get-an-earlier
diff --git a/TODO.txt b/TODO.txt
index 563339a..283723b 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -31,6 +31,7 @@ Key:
- Make reports use filenames, not module names
- implement plugin support in CTracer
- remove plugin support from PyTracer
+- documentation
+ Remove code only run on <2.6
- Change data file to json
- Create data api
diff --git a/coverage/annotate.py b/coverage/annotate.py
index 5b96448..3487feb 100644
--- a/coverage/annotate.py
+++ b/coverage/annotate.py
@@ -53,7 +53,9 @@ class AnnotateReporter(Reporter):
if self.directory:
dest_file = os.path.join(self.directory, cu.flat_rootname())
- dest_file += ".py,cover"
+ if dest_file.endswith("_py"):
+ dest_file = dest_file[:-3] + ".py"
+ dest_file += ",cover"
else:
dest_file = cu.filename + ",cover"
diff --git a/coverage/codeunit.py b/coverage/codeunit.py
index 2815526..e75018d 100644
--- a/coverage/codeunit.py
+++ b/coverage/codeunit.py
@@ -28,19 +28,18 @@ class CodeUnit(FileReporter):
self.filename = self.file_locator.canonical_filename(f)
if hasattr(morf, '__name__'):
- n = modname = morf.__name__
+ n = morf.__name__
+ n = n.replace(".", os.sep) + ".py"
self.relative = True
else:
- n = os.path.splitext(morf)[0]
+ n = f #os.path.splitext(f)[0]
rel = self.file_locator.relative_filename(n)
if os.path.isabs(n):
self.relative = (rel != n)
else:
self.relative = True
n = rel
- modname = None
self.name = n
- self.modname = modname
def _adjust_filename(self, f):
# TODO: This shouldn't be in the base class, right?
@@ -56,8 +55,5 @@ class CodeUnit(FileReporter):
For example, the file a/b/c.py will return 'a_b_c'
"""
- if self.modname:
- return self.modname.replace('.', '_')
- else:
- root = os.path.splitdrive(self.name)[1]
- return root.replace('\\', '_').replace('/', '_').replace('.', '_')
+ root = os.path.splitdrive(self.name)[1]
+ return root.replace('\\', '_').replace('/', '_').replace('.', '_')
diff --git a/tests/farm/html/gold_a/a.html b/tests/farm/html/gold_a/a_py.html
index 03c1fc9..03c1fc9 100644
--- a/tests/farm/html/gold_a/a.html
+++ b/tests/farm/html/gold_a/a_py.html
diff --git a/tests/farm/html/gold_b_branch/b.html b/tests/farm/html/gold_b_branch/b_py.html
index 15b0666..15b0666 100644
--- a/tests/farm/html/gold_b_branch/b.html
+++ b/tests/farm/html/gold_b_branch/b_py.html
diff --git a/tests/farm/html/gold_bom/bom.html b/tests/farm/html/gold_bom/bom_py.html
index 40c64bd..40c64bd 100644
--- a/tests/farm/html/gold_bom/bom.html
+++ b/tests/farm/html/gold_bom/bom_py.html
diff --git a/tests/farm/html/gold_isolatin1/isolatin1.html b/tests/farm/html/gold_isolatin1/isolatin1_py.html
index 0e4ac95..0e4ac95 100644
--- a/tests/farm/html/gold_isolatin1/isolatin1.html
+++ b/tests/farm/html/gold_isolatin1/isolatin1_py.html
diff --git a/tests/farm/html/gold_omit_1/m1.html b/tests/farm/html/gold_omit_1/m1_py.html
index de44f78..de44f78 100644
--- a/tests/farm/html/gold_omit_1/m1.html
+++ b/tests/farm/html/gold_omit_1/m1_py.html
diff --git a/tests/farm/html/gold_omit_1/m2.html b/tests/farm/html/gold_omit_1/m2_py.html
index c775e6b..c775e6b 100644
--- a/tests/farm/html/gold_omit_1/m2.html
+++ b/tests/farm/html/gold_omit_1/m2_py.html
diff --git a/tests/farm/html/gold_omit_1/m3.html b/tests/farm/html/gold_omit_1/m3_py.html
index 67354c4..67354c4 100644
--- a/tests/farm/html/gold_omit_1/m3.html
+++ b/tests/farm/html/gold_omit_1/m3_py.html
diff --git a/tests/farm/html/gold_omit_1/main.html b/tests/farm/html/gold_omit_1/main_py.html
index a71b10e..a71b10e 100644
--- a/tests/farm/html/gold_omit_1/main.html
+++ b/tests/farm/html/gold_omit_1/main_py.html
diff --git a/tests/farm/html/gold_omit_2/m2.html b/tests/farm/html/gold_omit_2/m2_py.html
index c775e6b..c775e6b 100644
--- a/tests/farm/html/gold_omit_2/m2.html
+++ b/tests/farm/html/gold_omit_2/m2_py.html
diff --git a/tests/farm/html/gold_omit_2/m3.html b/tests/farm/html/gold_omit_2/m3_py.html
index 67354c4..67354c4 100644
--- a/tests/farm/html/gold_omit_2/m3.html
+++ b/tests/farm/html/gold_omit_2/m3_py.html
diff --git a/tests/farm/html/gold_omit_2/main.html b/tests/farm/html/gold_omit_2/main_py.html
index a71b10e..a71b10e 100644
--- a/tests/farm/html/gold_omit_2/main.html
+++ b/tests/farm/html/gold_omit_2/main_py.html
diff --git a/tests/farm/html/gold_omit_3/m3.html b/tests/farm/html/gold_omit_3/m3_py.html
index 67354c4..67354c4 100644
--- a/tests/farm/html/gold_omit_3/m3.html
+++ b/tests/farm/html/gold_omit_3/m3_py.html
diff --git a/tests/farm/html/gold_omit_3/main.html b/tests/farm/html/gold_omit_3/main_py.html
index a71b10e..a71b10e 100644
--- a/tests/farm/html/gold_omit_3/main.html
+++ b/tests/farm/html/gold_omit_3/main_py.html
diff --git a/tests/farm/html/gold_omit_4/m1.html b/tests/farm/html/gold_omit_4/m1_py.html
index de44f78..de44f78 100644
--- a/tests/farm/html/gold_omit_4/m1.html
+++ b/tests/farm/html/gold_omit_4/m1_py.html
diff --git a/tests/farm/html/gold_omit_4/m3.html b/tests/farm/html/gold_omit_4/m3_py.html
index 67354c4..67354c4 100644
--- a/tests/farm/html/gold_omit_4/m3.html
+++ b/tests/farm/html/gold_omit_4/m3_py.html
diff --git a/tests/farm/html/gold_omit_4/main.html b/tests/farm/html/gold_omit_4/main_py.html
index a71b10e..a71b10e 100644
--- a/tests/farm/html/gold_omit_4/main.html
+++ b/tests/farm/html/gold_omit_4/main_py.html
diff --git a/tests/farm/html/gold_omit_5/m1.html b/tests/farm/html/gold_omit_5/m1_py.html
index de44f78..de44f78 100644
--- a/tests/farm/html/gold_omit_5/m1.html
+++ b/tests/farm/html/gold_omit_5/m1_py.html
diff --git a/tests/farm/html/gold_omit_5/main.html b/tests/farm/html/gold_omit_5/main_py.html
index a71b10e..a71b10e 100644
--- a/tests/farm/html/gold_omit_5/main.html
+++ b/tests/farm/html/gold_omit_5/main_py.html
diff --git a/tests/farm/html/gold_other/blah_blah_other.html b/tests/farm/html/gold_other/blah_blah_other_py.html
index f070f3e..f070f3e 100644
--- a/tests/farm/html/gold_other/blah_blah_other.html
+++ b/tests/farm/html/gold_other/blah_blah_other_py.html
diff --git a/tests/farm/html/gold_other/here.html b/tests/farm/html/gold_other/here_py.html
index e091395..e091395 100644
--- a/tests/farm/html/gold_other/here.html
+++ b/tests/farm/html/gold_other/here_py.html
diff --git a/tests/farm/html/gold_partial/partial.html b/tests/farm/html/gold_partial/partial_py.html
index 64dfacf..64dfacf 100644
--- a/tests/farm/html/gold_partial/partial.html
+++ b/tests/farm/html/gold_partial/partial_py.html
diff --git a/tests/farm/html/gold_styled/a.html b/tests/farm/html/gold_styled/a_py.html
index 9fdaee1..9fdaee1 100644
--- a/tests/farm/html/gold_styled/a.html
+++ b/tests/farm/html/gold_styled/a_py.html
diff --git a/tests/farm/html/gold_unicode/unicode.html b/tests/farm/html/gold_unicode/unicode_py.html
index d67af56..d67af56 100644
--- a/tests/farm/html/gold_unicode/unicode.html
+++ b/tests/farm/html/gold_unicode/unicode_py.html
diff --git a/tests/farm/html/gold_x_xml/coverage.xml b/tests/farm/html/gold_x_xml/coverage.xml
index d5a8c44..f528e12 100644
--- a/tests/farm/html/gold_x_xml/coverage.xml
+++ b/tests/farm/html/gold_x_xml/coverage.xml
@@ -7,9 +7,9 @@
<source></source>
</sources>
<packages>
- <package branch-rate="0" complexity="0" line-rate="0.6667" name="">
+ <package branch-rate="0" complexity="0" line-rate="0.6667" name="a">
<classes>
- <class branch-rate="0" complexity="0" filename="a.py" line-rate="0.6667" name="a">
+ <class branch-rate="0" complexity="0" filename="a.py" line-rate="0.6667" name="a.py">
<methods/>
<lines>
<line hits="1" number="3"/>
diff --git a/tests/farm/html/gold_y_xml_branch/coverage.xml b/tests/farm/html/gold_y_xml_branch/coverage.xml
index 86e9e73..eb0c532 100644
--- a/tests/farm/html/gold_y_xml_branch/coverage.xml
+++ b/tests/farm/html/gold_y_xml_branch/coverage.xml
@@ -7,9 +7,9 @@
<source></source>
</sources>
<packages>
- <package branch-rate="0.5" complexity="0" line-rate="0.8" name="">
+ <package branch-rate="0.5" complexity="0" line-rate="0.8" name="y">
<classes>
- <class branch-rate="0.5" complexity="0" filename="y.py" line-rate="0.8" name="y">
+ <class branch-rate="0.5" complexity="0" filename="y.py" line-rate="0.8" name="y.py">
<methods/>
<lines>
<line hits="1" number="3"/>
diff --git a/tests/farm/html/run_a.py b/tests/farm/html/run_a.py
index 3fabd6f..7963d2e 100644
--- a/tests/farm/html/run_a.py
+++ b/tests/farm/html/run_a.py
@@ -12,13 +12,13 @@ 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.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.html'>a</a>",
+ "<a href='a_py.html'>a.py</a>",
"<span class='pc_cov'>67%</span>",
"<td class='right' data-ratio='2 3'>67%</td>",
)
diff --git a/tests/farm/html/run_b_branch.py b/tests/farm/html/run_b_branch.py
index 0e584a6..c92252c 100644
--- a/tests/farm/html/run_b_branch.py
+++ b/tests/farm/html/run_b_branch.py
@@ -12,7 +12,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("gold_b_branch", "html_b_branch", size_within=10, file_pattern="*.html")
-contains("html_b_branch/b.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>",
@@ -21,7 +21,7 @@ contains("html_b_branch/b.html",
"<span class='annotate' title='no jumps to these line numbers'>23&nbsp;&nbsp; 25</span>",
)
contains("html_b_branch/index.html",
- "<a href='b.html'>b</a>",
+ "<a href='b_py.html'>b.py</a>",
"<span class='pc_cov'>70%</span>",
"<td class='right' data-ratio='16 23'>70%</td>",
)
diff --git a/tests/farm/html/run_bom.py b/tests/farm/html/run_bom.py
index c35079b..9694975 100644
--- a/tests/farm/html/run_bom.py
+++ b/tests/farm/html/run_bom.py
@@ -14,7 +14,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("gold_bom", "html_bom", size_within=10, file_pattern="*.html")
-contains("html_bom/bom.html",
+contains("html_bom/bom_py.html",
"<span class='str'>&quot;3&#215;4 = 12, &#247;2 = 6&#177;0&quot;</span>",
)
diff --git a/tests/farm/html/run_isolatin1.py b/tests/farm/html/run_isolatin1.py
index 063e6e0..bf3746d 100644
--- a/tests/farm/html/run_isolatin1.py
+++ b/tests/farm/html/run_isolatin1.py
@@ -14,7 +14,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("gold_isolatin1", "html_isolatin1", size_within=10, file_pattern="*.html")
-contains("html_isolatin1/isolatin1.html",
+contains("html_isolatin1/isolatin1_py.html",
"<span class='str'>&quot;3&#215;4 = 12, &#247;2 = 6&#177;0&quot;</span>",
)
diff --git a/tests/farm/html/run_other.py b/tests/farm/html/run_other.py
index 23ce29f..05efa0f 100644
--- a/tests/farm/html/run_other.py
+++ b/tests/farm/html/run_other.py
@@ -12,15 +12,15 @@ 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.html"):
- os.rename(p, "html_other/blah_blah_other.html")
+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.html'>here</a>",
- "other.html'>", "other</a>",
+ "<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
index eab1441..3879079 100644
--- a/tests/farm/html/run_partial.py
+++ b/tests/farm/html/run_partial.py
@@ -14,7 +14,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("gold_partial", "html_partial", size_within=10, file_pattern="*.html")
-contains("html_partial/partial.html",
+contains("html_partial/partial_py.html",
"<p id='t5' class='stm run hide_run'>",
"<p id='t8' class='stm run hide_run'>",
"<p id='t11' class='stm run hide_run'>",
@@ -22,7 +22,7 @@ contains("html_partial/partial.html",
"<p id='t14' class='pln'>",
)
contains("html_partial/index.html",
- "<a href='partial.html'>partial</a>",
+ "<a href='partial_py.html'>partial.py</a>",
)
contains("html_partial/index.html",
"<span class='pc_cov'>100%</span>"
diff --git a/tests/farm/html/run_styled.py b/tests/farm/html/run_styled.py
index ac538ff..a18096a 100644
--- a/tests/farm/html/run_styled.py
+++ b/tests/farm/html/run_styled.py
@@ -13,7 +13,7 @@ runfunc(html_it, rundir="src")
# 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",
+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>",
@@ -21,7 +21,7 @@ contains("html_styled/a.html",
)
contains("html_styled/index.html",
"<link rel='stylesheet' href='extra.css' type='text/css'>",
- "<a href='a.html'>a</a>",
+ "<a href='a_py.html'>a.py</a>",
"<span class='pc_cov'>67%</span>"
)
diff --git a/tests/farm/html/run_tabbed.py b/tests/farm/html/run_tabbed.py
index 0e9b527..679db2e 100644
--- a/tests/farm/html/run_tabbed.py
+++ b/tests/farm/html/run_tabbed.py
@@ -12,7 +12,7 @@ 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.html",
+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; "
@@ -20,5 +20,5 @@ contains("html_tabbed/tabbed.html",
"<span class='com'># look nice</span>"
)
-doesnt_contain("html_tabbed/tabbed.html", "\t")
+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
index c8cb6c5..ba34f63 100644
--- a/tests/farm/html/run_unicode.py
+++ b/tests/farm/html/run_unicode.py
@@ -12,11 +12,11 @@ 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.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.html",
+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>",
)
diff --git a/tests/test_api.py b/tests/test_api.py
index 08f4e05..00f6dbe 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -57,9 +57,9 @@ class SingletonApiTest(CoverageTest):
self.do_report_work("mycode2")
coverage.report(["mycode2.py"])
self.assertEqual(self.stdout(), textwrap.dedent("""\
- Name Stmts Miss Cover Missing
- ---------------------------------------
- mycode2 7 3 57% 4-6
+ Name Stmts Miss Cover Missing
+ ------------------------------------------
+ mycode2.py 7 3 57% 4-6
"""))
def test_report_file(self):
@@ -69,9 +69,9 @@ class SingletonApiTest(CoverageTest):
coverage.report(["mycode3.py"], file=fout)
self.assertEqual(self.stdout(), "")
self.assertEqual(fout.getvalue(), textwrap.dedent("""\
- Name Stmts Miss Cover Missing
- ---------------------------------------
- mycode3 7 3 57% 4-6
+ Name Stmts Miss Cover Missing
+ ------------------------------------------
+ mycode3.py 7 3 57% 4-6
"""))
def test_report_default(self):
@@ -79,7 +79,7 @@ class SingletonApiTest(CoverageTest):
self.do_report_work("mycode4")
coverage.report()
rpt = re.sub(r"\s+", " ", self.stdout())
- self.assertIn("mycode4 7 3 57% 4-6", rpt)
+ self.assertIn("mycode4.py 7 3 57% 4-6", rpt)
class ApiTest(CoverageTest):
@@ -571,9 +571,9 @@ class PluginTest(CoverageTest):
cov.save()
cov.report(["no_biggie.py"])
self.assertEqual(self.stdout(), textwrap.dedent("""\
- Name Stmts Miss Cover Missing
- -----------------------------------------
- no_biggie 4 1 75% 4
+ Name Stmts Miss Cover Missing
+ --------------------------------------------
+ no_biggie.py 4 1 75% 4
"""))
def test_nose_plugin(self):
diff --git a/tests/test_codeunit.py b/tests/test_codeunit.py
index 54e525b..1a064fc 100644
--- a/tests/test_codeunit.py
+++ b/tests/test_codeunit.py
@@ -27,12 +27,12 @@ class CodeUnitTest(CoverageTest):
acu = PythonCodeUnit("aa/afile.py")
bcu = PythonCodeUnit("aa/bb/bfile.py")
ccu = PythonCodeUnit("aa/bb/cc/cfile.py")
- self.assertEqual(acu.name, "aa/afile")
- self.assertEqual(bcu.name, "aa/bb/bfile")
- self.assertEqual(ccu.name, "aa/bb/cc/cfile")
- self.assertEqual(acu.flat_rootname(), "aa_afile")
- self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile")
- self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_cfile")
+ self.assertEqual(acu.name, "aa/afile.py")
+ self.assertEqual(bcu.name, "aa/bb/bfile.py")
+ self.assertEqual(ccu.name, "aa/bb/cc/cfile.py")
+ self.assertEqual(acu.flat_rootname(), "aa_afile_py")
+ self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_py")
+ self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_cfile_py")
self.assertEqual(acu.source(), "# afile.py\n")
self.assertEqual(bcu.source(), "# bfile.py\n")
self.assertEqual(ccu.source(), "# cfile.py\n")
@@ -41,12 +41,12 @@ class CodeUnitTest(CoverageTest):
acu = PythonCodeUnit("aa/afile.odd.py")
bcu = PythonCodeUnit("aa/bb/bfile.odd.py")
b2cu = PythonCodeUnit("aa/bb.odd/bfile.py")
- self.assertEqual(acu.name, "aa/afile.odd")
- self.assertEqual(bcu.name, "aa/bb/bfile.odd")
- self.assertEqual(b2cu.name, "aa/bb.odd/bfile")
- self.assertEqual(acu.flat_rootname(), "aa_afile_odd")
- self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_odd")
- self.assertEqual(b2cu.flat_rootname(), "aa_bb_odd_bfile")
+ self.assertEqual(acu.name, "aa/afile.odd.py")
+ self.assertEqual(bcu.name, "aa/bb/bfile.odd.py")
+ self.assertEqual(b2cu.name, "aa/bb.odd/bfile.py")
+ self.assertEqual(acu.flat_rootname(), "aa_afile_odd_py")
+ self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_odd_py")
+ self.assertEqual(b2cu.flat_rootname(), "aa_bb_odd_bfile_py")
self.assertEqual(acu.source(), "# afile.odd.py\n")
self.assertEqual(bcu.source(), "# bfile.odd.py\n")
self.assertEqual(b2cu.source(), "# bfile.py\n")
@@ -59,12 +59,12 @@ class CodeUnitTest(CoverageTest):
acu = PythonCodeUnit(aa)
bcu = PythonCodeUnit(aa.bb)
ccu = PythonCodeUnit(aa.bb.cc)
- self.assertEqual(acu.name, "aa")
- self.assertEqual(bcu.name, "aa.bb")
- self.assertEqual(ccu.name, "aa.bb.cc")
- self.assertEqual(acu.flat_rootname(), "aa")
- self.assertEqual(bcu.flat_rootname(), "aa_bb")
- self.assertEqual(ccu.flat_rootname(), "aa_bb_cc")
+ self.assertEqual(acu.name, "aa.py")
+ self.assertEqual(bcu.name, "aa/bb.py")
+ self.assertEqual(ccu.name, "aa/bb/cc.py")
+ self.assertEqual(acu.flat_rootname(), "aa_py")
+ self.assertEqual(bcu.flat_rootname(), "aa_bb_py")
+ self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_py")
self.assertEqual(acu.source(), "# aa\n")
self.assertEqual(bcu.source(), "# bb\n")
self.assertEqual(ccu.source(), "") # yes, empty
@@ -77,12 +77,12 @@ class CodeUnitTest(CoverageTest):
acu = PythonCodeUnit(aa.afile)
bcu = PythonCodeUnit(aa.bb.bfile)
ccu = PythonCodeUnit(aa.bb.cc.cfile)
- self.assertEqual(acu.name, "aa.afile")
- self.assertEqual(bcu.name, "aa.bb.bfile")
- self.assertEqual(ccu.name, "aa.bb.cc.cfile")
- self.assertEqual(acu.flat_rootname(), "aa_afile")
- self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile")
- self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_cfile")
+ self.assertEqual(acu.name, "aa/afile.py")
+ self.assertEqual(bcu.name, "aa/bb/bfile.py")
+ self.assertEqual(ccu.name, "aa/bb/cc/cfile.py")
+ self.assertEqual(acu.flat_rootname(), "aa_afile_py")
+ self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_py")
+ self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_cfile_py")
self.assertEqual(acu.source(), "# afile.py\n")
self.assertEqual(bcu.source(), "# bfile.py\n")
self.assertEqual(ccu.source(), "# cfile.py\n")
diff --git a/tests/test_html.py b/tests/test_html.py
index cf143cc..cc81798 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -38,13 +38,13 @@ class HtmlTestHelpers(CoverageTest):
def remove_html_files(self):
"""Remove the HTML files created as part of the HTML report."""
os.remove("htmlcov/index.html")
- os.remove("htmlcov/main_file.html")
- os.remove("htmlcov/helper1.html")
- os.remove("htmlcov/helper2.html")
+ os.remove("htmlcov/main_file_py.html")
+ os.remove("htmlcov/helper1_py.html")
+ os.remove("htmlcov/helper2_py.html")
def get_html_report_content(self, module):
"""Return the content of the HTML report for `module`."""
- filename = module.replace(".py", ".html").replace("/", "_")
+ filename = module.replace(".", "_").replace("/", "_") + ".html"
filename = os.path.join("htmlcov", filename)
with open(filename) as f:
return f.read()
@@ -70,9 +70,9 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
self.run_coverage()
self.assert_exists("htmlcov/index.html")
- self.assert_exists("htmlcov/main_file.html")
- self.assert_exists("htmlcov/helper1.html")
- self.assert_exists("htmlcov/helper2.html")
+ self.assert_exists("htmlcov/main_file_py.html")
+ self.assert_exists("htmlcov/helper1_py.html")
+ self.assert_exists("htmlcov/helper2_py.html")
self.assert_exists("htmlcov/style.css")
self.assert_exists("htmlcov/coverage_html.js")
@@ -96,9 +96,9 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
# Only the changed files should have been created.
self.assert_exists("htmlcov/index.html")
- self.assert_exists("htmlcov/helper1.html")
- self.assert_doesnt_exist("htmlcov/main_file.html")
- self.assert_doesnt_exist("htmlcov/helper2.html")
+ self.assert_exists("htmlcov/helper1_py.html")
+ self.assert_doesnt_exist("htmlcov/main_file_py.html")
+ self.assert_doesnt_exist("htmlcov/helper2_py.html")
with open("htmlcov/index.html") as f:
index2 = f.read()
self.assertMultiLineEqual(index1, index2)
@@ -121,9 +121,9 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
# Only the changed files should have been created.
self.assert_exists("htmlcov/index.html")
- self.assert_exists("htmlcov/helper1.html")
- self.assert_exists("htmlcov/main_file.html")
- self.assert_doesnt_exist("htmlcov/helper2.html")
+ self.assert_exists("htmlcov/helper1_py.html")
+ self.assert_exists("htmlcov/main_file_py.html")
+ self.assert_doesnt_exist("htmlcov/helper2_py.html")
def test_html_delta_from_settings_change(self):
# HTML generation can create only the files that have changed.
@@ -139,9 +139,9 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
# All the files have been reported again.
self.assert_exists("htmlcov/index.html")
- self.assert_exists("htmlcov/helper1.html")
- self.assert_exists("htmlcov/main_file.html")
- self.assert_exists("htmlcov/helper2.html")
+ self.assert_exists("htmlcov/helper1_py.html")
+ self.assert_exists("htmlcov/main_file_py.html")
+ self.assert_exists("htmlcov/helper2_py.html")
with open("htmlcov/index.html") as f:
index2 = f.read()
self.assertMultiLineEqual(index1, index2)
@@ -163,9 +163,9 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
# All the files have been reported again.
self.assert_exists("htmlcov/index.html")
- self.assert_exists("htmlcov/helper1.html")
- self.assert_exists("htmlcov/main_file.html")
- self.assert_exists("htmlcov/helper2.html")
+ self.assert_exists("htmlcov/helper1_py.html")
+ self.assert_exists("htmlcov/main_file_py.html")
+ self.assert_exists("htmlcov/helper2_py.html")
with open("htmlcov/index.html") as f:
index2 = f.read()
fixed_index2 = index2.replace("XYZZY", self.real_coverage_version)
diff --git a/tests/test_process.py b/tests/test_process.py
index 0409e4a..569618e 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -170,9 +170,9 @@ class ProcessTest(CoverageTest):
# Reporting should still work even with the .rc file
out = self.run_command("coverage report")
self.assertMultiLineEqual(out, textwrap.dedent("""\
- Name Stmts Miss Cover
- ----------------------------
- b_or_c 7 0 100%
+ Name Stmts Miss Cover
+ -------------------------------
+ b_or_c.py 7 0 100%
"""))
def test_combine_with_aliases(self):
@@ -636,7 +636,7 @@ class FailUnderTest(CoverageTest):
self.assertEqual(st, 0)
self.assertEqual(
self.last_line_squeezed(out),
- "forty_two_plus 7 4 43%"
+ "forty_two_plus.py 7 4 43%"
)
def test_report(self):
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 21817a5..8c9cf6d 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -26,18 +26,18 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'done\n')
report = self.report_from_command("coverage report")
- # Name Stmts Miss Cover
- # ---------------------------------------------------------------------
- # c:/ned/coverage/trunk/tests/modules/covmod1 2 0 100%
- # c:/ned/coverage/trunk/tests/zipmods.zip/covmodzip1 2 0 100%
- # mycode 4 0 100%
- # ---------------------------------------------------------------------
- # TOTAL 8 0 100%
+ # Name Stmts Miss Cover
+ # ------------------------------------------------------------------------
+ # c:/ned/coverage/trunk/tests/modules/covmod1.py 2 0 100%
+ # c:/ned/coverage/trunk/tests/zipmods.zip/covmodzip1.py 2 0 100%
+ # mycode.py 4 0 100%
+ # ------------------------------------------------------------------------
+ # TOTAL 8 0 100%
self.assertNotIn("/coverage/__init__/", report)
- self.assertIn("/tests/modules/covmod1 ", report)
- self.assertIn("/tests/zipmods.zip/covmodzip1 ", report)
- self.assertIn("mycode ", report)
+ self.assertIn("/tests/modules/covmod1.py ", report)
+ self.assertIn("/tests/zipmods.zip/covmodzip1.py ", report)
+ self.assertIn("mycode.py ", report)
self.assertEqual(self.last_line_squeezed(report), "TOTAL 8 0 100%")
def test_report_just_one(self):
@@ -45,32 +45,32 @@ class SummaryTest(CoverageTest):
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report mycode.py")
- # Name Stmts Miss Cover
- # ----------------------------
- # mycode 4 0 100%
+ # Name Stmts Miss Cover
+ # -------------------------------
+ # mycode.py 4 0 100%
self.assertEqual(self.line_count(report), 3)
self.assertNotIn("/coverage/", report)
- self.assertNotIn("/tests/modules/covmod1 ", report)
- self.assertNotIn("/tests/zipmods.zip/covmodzip1 ", report)
- self.assertIn("mycode ", report)
- self.assertEqual(self.last_line_squeezed(report), "mycode 4 0 100%")
+ self.assertNotIn("/tests/modules/covmod1.py ", report)
+ self.assertNotIn("/tests/zipmods.zip/covmodzip1.py ", report)
+ self.assertIn("mycode.py ", report)
+ self.assertEqual(self.last_line_squeezed(report), "mycode.py 4 0 100%")
def test_report_wildcard(self):
# Try reporting using wildcards to get the modules.
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report my*.py")
- # Name Stmts Miss Cover
- # ----------------------------
- # mycode 4 0 100%
+ # Name Stmts Miss Cover
+ # -------------------------------
+ # mycode.py 4 0 100%
self.assertEqual(self.line_count(report), 3)
self.assertNotIn("/coverage/", report)
- self.assertNotIn("/tests/modules/covmod1 ", report)
- self.assertNotIn("/tests/zipmods.zip/covmodzip1 ", report)
- self.assertIn("mycode ", report)
- self.assertEqual(self.last_line_squeezed(report), "mycode 4 0 100%")
+ self.assertNotIn("/tests/modules/covmod1.py ", report)
+ self.assertNotIn("/tests/zipmods.zip/covmodzip1.py ", report)
+ self.assertIn("mycode.py ", report)
+ self.assertEqual(self.last_line_squeezed(report), "mycode.py 4 0 100%")
def test_report_omitting(self):
# Try reporting while omitting some modules
@@ -80,32 +80,32 @@ class SummaryTest(CoverageTest):
"coverage report --omit '%s/*'" % prefix
)
- # Name Stmts Miss Cover
- # ----------------------------
- # mycode 4 0 100%
+ # Name Stmts Miss Cover
+ # -------------------------------
+ # mycode.py 4 0 100%
self.assertEqual(self.line_count(report), 3)
self.assertNotIn("/coverage/", report)
- self.assertNotIn("/tests/modules/covmod1 ", report)
- self.assertNotIn("/tests/zipmods.zip/covmodzip1 ", report)
- self.assertIn("mycode ", report)
- self.assertEqual(self.last_line_squeezed(report), "mycode 4 0 100%")
+ self.assertNotIn("/tests/modules/covmod1.py ", report)
+ self.assertNotIn("/tests/zipmods.zip/covmodzip1.py ", report)
+ self.assertIn("mycode.py ", report)
+ self.assertEqual(self.last_line_squeezed(report), "mycode.py 4 0 100%")
def test_report_including(self):
# Try reporting while including some modules
self.run_command("coverage run mycode.py")
report = self.report_from_command("coverage report --include=mycode*")
- # Name Stmts Miss Cover
- # ----------------------------
- # mycode 4 0 100%
+ # Name Stmts Miss Cover
+ # -------------------------------
+ # mycode.py 4 0 100%
self.assertEqual(self.line_count(report), 3)
self.assertNotIn("/coverage/", report)
- self.assertNotIn("/tests/modules/covmod1 ", report)
- self.assertNotIn("/tests/zipmods.zip/covmodzip1 ", report)
- self.assertIn("mycode ", report)
- self.assertEqual(self.last_line_squeezed(report), "mycode 4 0 100%")
+ self.assertNotIn("/tests/modules/covmod1.py ", report)
+ self.assertNotIn("/tests/zipmods.zip/covmodzip1.py ", report)
+ self.assertIn("mycode.py ", report)
+ self.assertEqual(self.last_line_squeezed(report), "mycode.py 4 0 100%")
def test_report_branches(self):
self.make_file("mybranch.py", """\
@@ -119,14 +119,14 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'x\n')
report = self.report_from_command("coverage report")
- # Name Stmts Miss Branch BrPart Cover
- # --------------------------------------------
- # mybranch 5 0 2 1 85%
+ # Name Stmts Miss Branch BrPart Cover
+ # -----------------------------------------------
+ # mybranch.py 5 0 2 1 85%
self.assertEqual(self.line_count(report), 3)
- self.assertIn("mybranch ", report)
+ self.assertIn("mybranch.py ", report)
self.assertEqual(self.last_line_squeezed(report),
- "mybranch 5 0 2 1 86%")
+ "mybranch.py 5 0 2 1 86%")
def test_report_show_missing(self):
self.make_file("mymissing.py", """\
@@ -149,14 +149,14 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'y\nz\n')
report = self.report_from_command("coverage report --show-missing")
- # Name Stmts Miss Cover Missing
- # -----------------------------------------
- # mymissing 14 3 79% 3-4, 10
+ # Name Stmts Miss Cover Missing
+ # --------------------------------------------
+ # mymissing.py 14 3 79% 3-4, 10
self.assertEqual(self.line_count(report), 3)
- self.assertIn("mymissing ", report)
+ self.assertIn("mymissing.py ", report)
self.assertEqual(self.last_line_squeezed(report),
- "mymissing 14 3 79% 3-4, 10")
+ "mymissing.py 14 3 79% 3-4, 10")
def test_report_show_missing_branches(self):
self.make_file("mybranch.py", """\
@@ -172,14 +172,14 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'x\ny\n')
report = self.report_from_command("coverage report --show-missing")
- # Name Stmts Miss Branch BrPart Cover Missing
- # -------------------------------------------------------
- # mybranch 7 0 4 2 82% 2->4, 4->6
+ # Name Stmts Miss Branch BrPart Cover Missing
+ # ----------------------------------------------------------
+ # mybranch.py 7 0 4 2 82% 2->4, 4->6
self.assertEqual(self.line_count(report), 3)
- self.assertIn("mybranch ", report)
+ self.assertIn("mybranch.py ", report)
self.assertEqual(self.last_line_squeezed(report),
- "mybranch 7 0 4 2 82% 2->4, 4->6")
+ "mybranch.py 7 0 4 2 82% 2->4, 4->6")
def test_report_show_missing_branches_and_lines(self):
self.make_file("main.py", """\
@@ -201,22 +201,22 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'x\ny\n')
report = self.report_from_command("coverage report --show-missing")
- # Name Stmts Miss Branch BrPart Cover Missing
- # -------------------------------------------------------
- # main 1 0 0 0 100%
- # mybranch 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7
- # -------------------------------------------------------
- # TOTAL 11 2 8 3 63%
+ # Name Stmts Miss Branch BrPart Cover Missing
+ # ----------------------------------------------------------
+ # main.py 1 0 0 0 100%
+ # mybranch.py 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7
+ # ----------------------------------------------------------
+ # TOTAL 11 2 8 3 63%
self.assertEqual(self.line_count(report), 6)
squeezed = self.squeezed_lines(report)
self.assertEqual(
squeezed[2],
- "main 1 0 0 0 100%"
+ "main.py 1 0 0 0 100%"
)
self.assertEqual(
squeezed[3],
- "mybranch 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7"
+ "mybranch.py 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7"
)
self.assertEqual(
squeezed[5],
@@ -239,13 +239,13 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, "z\n")
report = self.report_from_command("coverage report --skip-covered")
- # Name Stmts Miss Cover
- # ---------------------------------
- # not_covered 2 1 50%
+ # Name Stmts Miss Cover
+ # ------------------------------------
+ # not_covered.py 2 1 50%
self.assertEqual(self.line_count(report), 3, report)
squeezed = self.squeezed_lines(report)
- self.assertEqual(squeezed[2], "not_covered 2 1 50%")
+ self.assertEqual(squeezed[2], "not_covered.py 2 1 50%")
def test_report_skip_covered_branches(self):
self.make_file("main.py", """
@@ -267,13 +267,13 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, "n\nz\n")
report = self.report_from_command("coverage report --skip-covered")
- # Name Stmts Miss Branch BrPart Cover
- # -----------------------------------------------
- # not_covered 4 0 2 1 83%
+ # Name Stmts Miss Branch BrPart Cover
+ # --------------------------------------------------
+ # not_covered.py 4 0 2 1 83%
self.assertEqual(self.line_count(report), 3, report)
squeezed = self.squeezed_lines(report)
- self.assertEqual(squeezed[2], "not_covered 4 0 2 1 83%")
+ self.assertEqual(squeezed[2], "not_covered.py 4 0 2 1 83%")
def test_report_skip_covered_branches_with_totals(self):
self.make_file("main.py", """
@@ -300,17 +300,17 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, "n\nz\n")
report = self.report_from_command("coverage report --skip-covered")
- # Name Stmts Miss Branch BrPart Cover
- # -----------------------------------------------
- # also_not_run 2 1 0 0 50%
- # not_covered 4 0 2 1 83%
- # -----------------------------------------------
- # TOTAL 6 1 2 1 75%
+ # Name Stmts Miss Branch BrPart Cover
+ # --------------------------------------------------
+ # also_not_run.py 2 1 0 0 50%
+ # not_covered.py 4 0 2 1 83%
+ # --------------------------------------------------
+ # TOTAL 6 1 2 1 75%
self.assertEqual(self.line_count(report), 6, report)
squeezed = self.squeezed_lines(report)
- self.assertEqual(squeezed[2], "also_not_run 2 1 0 0 50%")
- self.assertEqual(squeezed[3], "not_covered 4 0 2 1 83%")
+ self.assertEqual(squeezed[2], "also_not_run.py 2 1 0 0 50%")
+ self.assertEqual(squeezed[3], "not_covered.py 4 0 2 1 83%")
self.assertEqual(squeezed[5], "TOTAL 6 1 2 1 75%")
def test_dotpy_not_python(self):
@@ -332,7 +332,7 @@ class SummaryTest(CoverageTest):
# The actual error message varies version to version
last = re.sub(r": '.*' at", ": 'error' at", last)
self.assertEqual(last,
- "mycode NotPython: "
+ "mycode.py NotPython: "
"Couldn't parse 'mycode.py' as Python source: "
"'error' at line 1"
)
@@ -390,7 +390,7 @@ class SummaryTest(CoverageTest):
import main # pragma: nested # pylint: disable=import-error,unused-variable
cov.stop() # pragma: nested
report = self.get_report(cov).splitlines()
- self.assertIn("mybranch 5 5 2 0 0%", report)
+ self.assertIn("mybranch.py 5 5 2 0 0%", report)
def run_TheCode_and_report_it(self):
"""A helper for the next few tests."""
@@ -467,8 +467,8 @@ class SummaryTest2(CoverageTest):
report = repout.getvalue().replace('\\', '/')
report = re.sub(r"\s+", " ", report)
- self.assertIn("tests/modules/pkg1/__init__ 1 0 100%", report)
- self.assertIn("tests/modules/pkg2/__init__ 0 0 100%", report)
+ self.assertIn("tests/modules/pkg1/__init__.py 1 0 100%", report)
+ self.assertIn("tests/modules/pkg2/__init__.py 0 0 100%", report)
class ReportingReturnValueTest(CoverageTest):