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 /coverage | |
| parent | 2f01ede8dd7eeb8f59db533921afd6ff56ff6acb (diff) | |
| download | python-coveragepy-a0d7920455a7844fecd97180256c9d6242fb5a14.tar.gz | |
Warnings can be disabled
Diffstat (limited to 'coverage')
| -rw-r--r-- | coverage/config.py | 4 | ||||
| -rw-r--r-- | coverage/control.py | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/coverage/config.py b/coverage/config.py index 3dd6ea9..3651de3 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -158,6 +158,7 @@ class CoverageConfig(object): self.cover_pylib = False self.data_file = ".coverage" self.debug = [] + self.disable_warnings = [] self.note = None self.parallel = False self.plugins = [] @@ -191,7 +192,7 @@ class CoverageConfig(object): # Options for plugins self.plugin_options = {} - MUST_BE_LIST = ["omit", "include", "debug", "plugins", "concurrency"] + MUST_BE_LIST = ["concurrency", "debug", "disable_warnings", "include", "omit", "plugins"] def from_args(self, **kwargs): """Read config values from `kwargs`.""" @@ -283,6 +284,7 @@ class CoverageConfig(object): ('cover_pylib', 'run:cover_pylib', 'boolean'), ('data_file', 'run:data_file'), ('debug', 'run:debug', 'list'), + ('disable_warnings', 'run:disable_warnings', 'list'), ('include', 'run:include', 'list'), ('note', 'run:note'), ('omit', 'run:omit', 'list'), diff --git a/coverage/control.py b/coverage/control.py index b67ed90..aeca9f7 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -608,6 +608,10 @@ class Coverage(object): For warning suppression, use `slug` as the shorthand. """ + if slug in self.config.disable_warnings: + # Don't issue the warning + return + self._warnings.append(msg) if slug: msg = "%s (%s)" % (msg, slug) |
