diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-04-04 07:08:41 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-04-04 07:08:41 -0400 |
commit | a0d7920455a7844fecd97180256c9d6242fb5a14 (patch) | |
tree | 1a84f8e2c315015d5519c2e5d7e3058930265588 /tests | |
parent | 2f01ede8dd7eeb8f59db533921afd6ff56ff6acb (diff) | |
download | python-coveragepy-a0d7920455a7844fecd97180256c9d6242fb5a14.tar.gz |
Warnings can be disabled
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_config.py | 2 | ||||
-rw-r--r-- | tests/test_process.py | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 2aa592b..9224046 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -245,6 +245,7 @@ class ConfigFileTest(CoverageTest): plugins.a_plugin plugins.another debug = callers, pids , dataio + disable_warnings = abcd , efgh [{section}report] ; these settings affect reporting. @@ -325,6 +326,7 @@ class ConfigFileTest(CoverageTest): self.assertTrue(cov.config.parallel) self.assertEqual(cov.config.concurrency, ["thread"]) self.assertEqual(cov.config.source, ["myapp"]) + self.assertEqual(cov.config.disable_warnings, ["abcd", "efgh"]) self.assertEqual(cov.get_exclude_list(), ["if 0:", r"pragma:?\s+no cover", "another_tab"]) self.assertTrue(cov.config.ignore_errors) diff --git a/tests/test_process.py b/tests/test_process.py index 237bc3c..16341f5 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -499,6 +499,24 @@ class ProcessTest(CoverageTest): Coverage.py warning: No data was collected. (no-data-collected) """), out) + def test_warnings_suppressed(self): + self.make_file("hello.py", """\ + import sys, os + print("Hello") + """) + self.make_file(".coveragerc", """\ + [run] + disable_warnings = no-data-collected, module-not-imported + """) + out = self.run_command("coverage run --source=sys,xyzzy,quux hello.py") + + self.assertIn("Hello\n", out) + self.assertIn(textwrap.dedent("""\ + Coverage.py warning: Module sys has no Python source. (module-not-python) + """), out) + self.assertNotIn("module-not-imported", out) + self.assertNotIn("no-data-collected", out) + def test_warnings_during_reporting(self): # While fixing issue #224, the warnings were being printed far too # often. Make sure they're not any more. |