summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-06-12 06:36:57 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-06-12 06:36:57 -0400
commitc210ecb765bc60b2424df284d0c101dc0bfeaf4d (patch)
tree9978747b379bfa57a803e1f01bd323206b79ef27
parent8ad4d1e4d1734a1c1a1a4c960a67ffab1d39528a (diff)
downloadpython-coveragepy-git-c210ecb765bc60b2424df284d0c101dc0bfeaf4d.tar.gz
Dynamic contexts can be disabled with 'none'
-rw-r--r--coverage/control.py7
-rw-r--r--doc/contexts.rst2
-rw-r--r--metacov.ini1
3 files changed, 7 insertions, 3 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 552f7bc2..4cd1adad 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -349,13 +349,14 @@ class Coverage(object):
# it for the main process.
self.config.parallel = True
- if self.config.dynamic_context is None:
+ dycon = self.config.dynamic_context
+ if not dycon or dycon == "none":
context_switchers = []
- elif self.config.dynamic_context == "test_function":
+ elif dycon == "test_function":
context_switchers = [should_start_context_test_function]
else:
raise CoverageException(
- "Don't understand dynamic_context setting: {!r}".format(self.config.dynamic_context)
+ "Don't understand dynamic_context setting: {!r}".format(dycon)
)
context_switchers.extend(
diff --git a/doc/contexts.rst b/doc/contexts.rst
index e8aa4ed4..6a1293fd 100644
--- a/doc/contexts.rst
+++ b/doc/contexts.rst
@@ -79,6 +79,8 @@ this empty context. For example, if you are recording test names as contexts,
then the code run by the test runner before (and between) tests will be in the
empty context.
+Dynamic contexts can be explicitly disabled by setting ``dynamic_context`` to
+``none``.
.. _context_reporting:
diff --git a/metacov.ini b/metacov.ini
index 80c508e9..3d4b7cf7 100644
--- a/metacov.ini
+++ b/metacov.ini
@@ -9,6 +9,7 @@ parallel = true
source =
${COVERAGE_HOME?}/coverage
${COVERAGE_HOME?}/tests
+dynamic_context = none
[report]
# We set a different pragma so our code won't be confused with test code.