Skip to content

Commit

Permalink
Finish up #967. Thanks, Bernát Gábor
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Apr 11, 2020
1 parent 97997d2 commit fd43e35
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ Unreleased
decorated async functions (`issue 946`_). This is now fixed. Thanks, Kjell
Braden.

- The :meth:`~coverage.Coverage.get_option` and
:meth:`~coverage.Coverage.set_option` methods can now manipulate the
``[paths]`` configuration setting. Thanks to Bernát Gábor for the fix for
`issue 967`_.

.. _issue 946: https://github.com/nedbat/coveragepy/issues/946
.. _issue 967: https://github.com/nedbat/coveragepy/issues/967


.. _changes_504:
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Arcadiy Ivanov
Aron Griffis
Artem Dayneko
Ben Finney
Bernát Gábor
Bill Hart
Brandon Rhodes
Brett Cannon
Expand Down
2 changes: 2 additions & 0 deletions coverage/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ def set_option(self, option_name, value):
`value` is the new value for the option.
"""
# Special-cased options.
if option_name == "paths":
self.paths = value
return
Expand Down Expand Up @@ -451,6 +452,7 @@ def get_option(self, option_name):
Returns the value of the option.
"""
# Special-cased options.
if option_name == "paths":
return self.paths

Expand Down
9 changes: 8 additions & 1 deletion coverage/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ def get_option(self, option_name):
option name. For example, the ``branch`` option in the ``[run]``
section of the config file would be indicated with `"run:branch"`.
Returns the value of the option.
Returns the value of the option. The type depends on the option
selected.
As a special case, an `option_name` of ``"paths"`` will return an
OrderedDict with the entire ``[paths]`` section value.
.. versionadded:: 4.0
Expand All @@ -394,6 +398,9 @@ def set_option(self, option_name, value):
[run]
branch = True
As a special case, an `option_name` of ``"paths"`` will replace the
entire ``[paths]`` section. The value should be an OrderedDict.
.. versionadded:: 4.0
"""
Expand Down

0 comments on commit fd43e35

Please sign in to comment.