summaryrefslogtreecommitdiff
path: root/tests/test_summary.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-01-20 21:24:10 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-01-20 21:24:10 -0500
commit25c7c9c0133bc21da53aa41baae0442360d727d1 (patch)
tree520bff27127104acc7301823346fa973ced5ab34 /tests/test_summary.py
parent46b123e14ba35db22282c124337b21e8d10f480f (diff)
downloadpython-coveragepy-git-25c7c9c0133bc21da53aa41baae0442360d727d1.tar.gz
Don't confuse run-include with report-include (and also omit). Fixes #621 and #622.
Diffstat (limited to 'tests/test_summary.py')
-rw-r--r--tests/test_summary.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_summary.py b/tests/test_summary.py
index e5f470f0..36913364 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -122,6 +122,41 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
self.assertIn("mycode.py ", report)
self.assertEqual(self.last_line_squeezed(report), "mycode.py 4 0 100%")
+ def test_run_source_vs_report_include(self):
+ # https://bitbucket.org/ned/coveragepy/issues/621/include-ignored-warning-when-using
+ self.make_file(".coveragerc", """\
+ [run]
+ source = .
+
+ [report]
+ include = mod/*,tests/*
+ """)
+ # It should be OK to use that configuration.
+ cov = coverage.Coverage()
+ with self.assert_warnings(cov, []):
+ cov.start()
+ cov.stop() # pragma: nested
+
+ def test_run_omit_vs_report_omit(self):
+ # https://bitbucket.org/ned/coveragepy/issues/622/report-omit-overwrites-run-omit
+ # report:omit shouldn't clobber run:omit.
+ self.make_mycode()
+ self.make_file(".coveragerc", """\
+ [run]
+ omit = */covmodzip1.py
+
+ [report]
+ omit = */covmod1.py
+ """)
+ self.run_command("coverage run mycode.py")
+
+ # Read the data written, to see that the right files have been omitted from running.
+ covdata = CoverageData()
+ covdata.read_file(".coverage")
+ files = [os.path.basename(p) for p in covdata.measured_files()]
+ self.assertIn("covmod1.py", files)
+ self.assertNotIn("covmodzip1.py", files)
+
def test_report_branches(self):
self.make_file("mybranch.py", """\
def branch(x):