diff options
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/coverage/control.py b/coverage/control.py index f7db26e9..14c22eb1 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -212,7 +212,6 @@ class Coverage(object): self._data = self._collector = None self._plugins = None self._inorout = None - self._inorout_class = InOrOut self._data_suffix = self._run_suffix = None self._exclude_re = None self._debug = None @@ -367,7 +366,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 +397,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 """ @@ -476,7 +482,10 @@ class Coverage(object): plugin._coverage_enabled = False # Create the file classifying substructure. - self._inorout = self._inorout_class(warn=self._warn) + self._inorout = InOrOut( + warn=self._warn, + debug=(self._debug if self._debug.should('trace') else None), + ) self._inorout.configure(self.config) self._inorout.plugins = self._plugins self._inorout.disp_class = self._collector.file_disposition_class @@ -822,7 +831,7 @@ class Coverage(object): def report( self, morfs=None, show_missing=None, ignore_errors=None, file=None, omit=None, include=None, skip_covered=None, - contexts=None, skip_empty=None, + contexts=None, skip_empty=None, precision=None, ): """Write a textual summary report to `file`. @@ -850,6 +859,9 @@ class Coverage(object): expressions (using :func:`re.search <python:re.search>`) will be included in the report. + `precision` is the number of digits to display after the decimal + point for percentages. + All of the arguments default to the settings read from the :ref:`configuration file <config>`. @@ -861,12 +873,15 @@ class Coverage(object): .. versionadded:: 5.0 The `contexts` and `skip_empty` parameters. + .. versionadded:: 5.2 + The `precision` parameter. + """ with override_config( self, ignore_errors=ignore_errors, report_omit=omit, report_include=include, show_missing=show_missing, skip_covered=skip_covered, - report_contexts=contexts, skip_empty=skip_empty, + report_contexts=contexts, skip_empty=skip_empty, precision=precision, ): reporter = SummaryReporter(self) return reporter.report(morfs, outfile=file) @@ -892,10 +907,12 @@ class Coverage(object): reporter = AnnotateReporter(self) reporter.report(morfs, directory=directory) - def html_report(self, morfs=None, directory=None, ignore_errors=None, - omit=None, include=None, extra_css=None, title=None, - skip_covered=None, show_contexts=None, contexts=None, - skip_empty=None): + def html_report( + self, morfs=None, directory=None, ignore_errors=None, + omit=None, include=None, extra_css=None, title=None, + skip_covered=None, show_contexts=None, contexts=None, + skip_empty=None, precision=None, + ): """Generate an HTML report. The HTML is written to `directory`. The file "index.html" is the @@ -923,7 +940,7 @@ class Coverage(object): ignore_errors=ignore_errors, report_omit=omit, report_include=include, html_dir=directory, extra_css=extra_css, html_title=title, skip_covered=skip_covered, show_contexts=show_contexts, report_contexts=contexts, - skip_empty=skip_empty, + skip_empty=skip_empty, precision=precision, ): reporter = HtmlReporter(self) return reporter.report(morfs) |