summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-04-21 13:38:11 -0400
committerNed Batchelder <ned@nedbatchelder.com>2013-04-21 13:38:11 -0400
commit70f663dc0ae6f8e663c0e048796f837cf0ef2983 (patch)
treee8d849214128f5964dfaefe3c940329fa0bf35de /tests/test_api.py
parentf5cfe193a73b08990fddd888167b6c6336b6803c (diff)
downloadpython-coveragepy-git-70f663dc0ae6f8e663c0e048796f837cf0ef2983.tar.gz
Don't touch files as unexecuted if they were omitted. Fixes #218.
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index 300a2374..097947d2 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -430,7 +430,7 @@ class OmitIncludeTestsMixin(UsingModulesMixin):
self.filenames_not_in(result, "p1a p1c p2a othera osa")
def test_omit_and_include(self):
- result = self.coverage_usepkgs( include=["*/p1*"], omit=["*/p1a.py"])
+ result = self.coverage_usepkgs(include=["*/p1*"], omit=["*/p1a.py"])
self.filenames_in(result, "p1b")
self.filenames_not_in(result, "p1a p1c p2a p2b")
@@ -467,6 +467,16 @@ class SourceOmitIncludeTest(OmitIncludeTestsMixin, CoverageTest):
self.filenames_in(lines, "p1b")
self.filenames_not_in(lines, "p1a p1c p2a p2b othera otherb osa osb")
+ def test_source_package_part_omitted(self):
+ # https://bitbucket.org/ned/coveragepy/issue/218
+ # Used to be if you omitted something executed and inside the source,
+ # then after it was executed but not recorded, it would be found in
+ # the search for unexecuted files, and given a score of 0%.
+ lines = self.coverage_usepkgs(source=["pkg1"], omit=["pkg1/p1b.py"])
+ self.filenames_in(lines, "p1a")
+ self.filenames_not_in(lines, "p1b")
+ self.assertEqual(lines['p1c'], 0)
+
class ReportIncludeOmitTest(OmitIncludeTestsMixin, CoverageTest):
"""Tests of the report include/omit functionality."""