summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.rst6
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--coverage/config.py2
-rw-r--r--coverage/control.py9
4 files changed, 17 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index c5dba71d..b88341a0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -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:
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 109974a3..115a1ad3 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -20,6 +20,7 @@ Arcadiy Ivanov
Aron Griffis
Artem Dayneko
Ben Finney
+Bernát Gábor
Bill Hart
Brandon Rhodes
Brett Cannon
diff --git a/coverage/config.py b/coverage/config.py
index 166f34ea..7876052b 100644
--- a/coverage/config.py
+++ b/coverage/config.py
@@ -421,6 +421,7 @@ class CoverageConfig(object):
`value` is the new value for the option.
"""
+ # Special-cased options.
if option_name == "paths":
self.paths = value
return
@@ -451,6 +452,7 @@ class CoverageConfig(object):
Returns the value of the option.
"""
+ # Special-cased options.
if option_name == "paths":
return self.paths
diff --git a/coverage/control.py b/coverage/control.py
index f7db26e9..2b8c3d26 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -367,7 +367,11 @@ class Coverage(object):
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
@@ -394,6 +398,9 @@ class Coverage(object):
[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
"""