diff options
-rw-r--r-- | coverage/control.py | 2 | ||||
-rw-r--r-- | tests/test_api.py | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py index e9691b8..33f2ef1 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -685,7 +685,7 @@ class Coverage(object): self._init() if self.include: if self.source or self.source_pkgs: - print("--include is ignored because --source is set") + self._warn("--include is ignored because --source is set", slug="include-ignored") if self.run_suffix: # Calling start() means we're running code, so use the run_suffix # as the data_suffix when we eventually save the data. diff --git a/tests/test_api.py b/tests/test_api.py index d287cc2..d7e47db 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -578,11 +578,9 @@ class SourceOmitIncludeTest(OmitIncludeTestsMixin, CoverageTest): return summary def test_source_include_exclusive(self): - lines = self.coverage_usepkgs(source=["pkg1"], include=["pkg2"]) - self.filenames_in(lines, "p1a p1b") - self.filenames_not_in(lines, "p2a p2b othera otherb osa osb") - out = self.stdout() - self.assertIn("--include is ignored", out) + cov = coverage.Coverage(source=["pkg1"], include=["pkg2"]) + with self.assert_warnings(cov, ["--include is ignored because --source is set"]): + cov.start() def test_source_package_as_dir(self): # pkg1 is a directory, since we cd'd into tests/modules in setUp. |