summaryrefslogtreecommitdiff
path: root/tests
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
commitba0b17991c9fc228faf649725717755d802c4eaf (patch)
tree597330722e49a0a81bd3c61b700aa7cd95565125 /tests
parente6b23c689a7c5b08131aff1962cccf8a93c50f3c (diff)
downloadpython-coveragepy-ba0b17991c9fc228faf649725717755d802c4eaf.tar.gz
Don't confuse run-include with report-include (and also omit). Fixes #621 and #622.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_config.py2
-rw-r--r--tests/test_summary.py35
2 files changed, 36 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index a9c74aa..0b4d40b 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -357,7 +357,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
self.assertEqual(cov.get_exclude_list(), ["if 0:", r"pragma:?\s+no cover", "another_tab"])
self.assertTrue(cov.config.ignore_errors)
- self.assertEqual(cov.config.run_omit, cov.config.report_omit)
+ self.assertEqual(cov.config.run_omit, ["twenty"])
self.assertEqual(cov.config.report_omit, ["one", "another", "some_more", "yet_more"])
self.assertEqual(cov.config.report_include, ["thirty"])
self.assertEqual(cov.config.precision, 3)
diff --git a/tests/test_summary.py b/tests/test_summary.py
index e5f470f..3691336 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):