diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-12-16 21:15:55 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-12-16 21:15:55 -0500 |
commit | 35ad479aec70232e45da8983a8389451c72dba50 (patch) | |
tree | 7a504bedb6310d2521586ed95aa0c6a8d980ef72 | |
parent | 0d5a9b8deee5c3d8609f6d417578f2e5038e2db8 (diff) | |
download | python-coveragepy-git-35ad479aec70232e45da8983a8389451c72dba50.tar.gz |
Clean up and credit the #265 work
-rw-r--r-- | CHANGES.rst | 5 | ||||
-rw-r--r-- | coverage/config.py | 10 |
2 files changed, 9 insertions, 6 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 569f4b50..ee9dd807 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -23,6 +23,10 @@ Unreleased ``[coverage:run]`` section of tox.ini. Implements part of `issue 519`_. Thanks, Stephen Finucane. +- Specifying both ``--source`` and ``--include`` no longer silently ignores the + include setting, instead it fails with a message. Thanks, Nathan Land and + Loïc Dachary. Closes `issue 265`_. + - The ``Coverage.combine`` method has a new parameter, ``strict=False``, to support failing if there are no data files to combine. @@ -69,6 +73,7 @@ Unreleased - Switched to pytest from nose for running the coverage.py tests. +.. _issue 265: https://bitbucket.org/ned/coveragepy/issues/265/when-using-source-include-is-silently .. _issue 412: https://bitbucket.org/ned/coveragepy/issues/412/coverage-combine-should-error-if-no .. _issue 505: https://bitbucket.org/ned/coveragepy/issues/505/use-canonical-filename-for-debounce .. _issue 510: https://bitbucket.org/ned/coveragepy/issues/510/erase-still-needed-in-42 diff --git a/coverage/config.py b/coverage/config.py index f3e296c3..287844b8 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -368,7 +368,6 @@ class CoverageConfig(object): Returns the value of the option. """ - # Check all the hard-coded options. for option_spec in self.CONFIG_FILE_OPTIONS: attr, where = option_spec[:2] @@ -384,10 +383,9 @@ class CoverageConfig(object): raise CoverageException("No such option: %r" % option_name) def sanity_check(self): - if ((self.source is not None) and - (self.include is not None)): - raise CoverageException( - "--include and --source are mutually exclusive") + """Check interactions among settings, and raise if there's a problem.""" + if (self.source is not None) and (self.include is not None): + raise CoverageException("--include and --source are mutually exclusive") def read_coverage_config(config_file, **kwargs): @@ -446,5 +444,5 @@ def read_coverage_config(config_file, **kwargs): config.from_args(**kwargs) config.sanity_check() - + return config_file, config |