diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-10-06 17:18:45 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-10-06 17:18:45 -0400 |
commit | 0f84f34beeb9539eae771a8749dd4add1d46843d (patch) | |
tree | 944b77f20a81da504a54c322c43328e016967046 /coverage/control.py | |
parent | c7a086c5a0c8c66deeb7befd8d76183cd45ac74f (diff) | |
download | python-coveragepy-git-0f84f34beeb9539eae771a8749dd4add1d46843d.tar.gz |
Add some needed details to the Coverage docstrings
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/coverage/control.py b/coverage/control.py index 6830afba..1a31bba8 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -153,7 +153,8 @@ class Coverage(object): by coverage. Importing measured files before coverage is started can mean that code is missed. - `context` is a string to use as the context label for collected data. + `context` is a string to use as the :ref:`static context <static_contexts>` + label for collected data. .. versionadded:: 4.0 The `concurrency` parameter. @@ -509,7 +510,7 @@ class Coverage(object): self.save() def erase(self): - """Erase previously-collected coverage data. + """Erase previously collected coverage data. This removes the in-memory data collected in this session as well as discarding the data file. @@ -526,14 +527,15 @@ class Coverage(object): def switch_context(self, new_context): """Switch to a new dynamic context. - `new_context` is a string to use as the context label - for collected data. If a :ref:`static context <static_contexts>` is in - use, the static and dynamic context labels will be joined together with - a pipe character. + `new_context` is a string to use as the + :ref:`dynamic context <dynamic_contexts>` label for collected data. + If a :ref:`static context <static_contexts>` is in use, the static and + dynamic context labels will be joined together with a pipe character. Coverage collection must be started already. .. versionadded:: 5.0 + """ if not self._started: raise CoverageException( # pragma: only jython @@ -792,11 +794,22 @@ class Coverage(object): If `skip_covered` is true, don't report on files with 100% coverage. + `contexts` is a list of regular expressions. Only data from + :ref:`dynamic contexts <dynamic_contexts>` that match one of those + expressions (using :func:`re.search <python:re.search>`) will be + included in the report. + All of the arguments default to the settings read from the :ref:`configuration file <config>`. Returns a float, the total percentage covered. + .. versionadded:: 4.0 + The `skip_covered` parameter. + + .. versionadded:: 5.0 + The `contexts` parameter. + """ with override_config( self, @@ -898,6 +911,8 @@ class Coverage(object): Returns a float, the total percentage covered. + .. versionadded:: 5.0 + """ with override_config(self, ignore_errors=ignore_errors, report_omit=omit, report_include=include, |