diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/cmdline.py | 1 | ||||
-rw-r--r-- | coverage/control.py | 16 | ||||
-rw-r--r-- | coverage/html.py | 4 |
3 files changed, 19 insertions, 2 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 111be9f4..14921145 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -574,6 +574,7 @@ class CoverageScript: concurrency=options.concurrency, check_preimported=True, context=options.context, + messages=True, ) if options.action == "debug": diff --git a/coverage/control.py b/coverage/control.py index c45b1245..958c98da 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -103,6 +103,7 @@ class Coverage: auto_data=False, timid=None, branch=None, config_file=True, source=None, source_pkgs=None, omit=None, include=None, debug=None, concurrency=None, check_preimported=False, context=None, + messages=False, ): # pylint: disable=too-many-arguments """ Many of these arguments duplicate and override values that can be @@ -173,6 +174,9 @@ class Coverage: `context` is a string to use as the :ref:`static context <static_contexts>` label for collected data. + If `messages` is true, some messages will be printed to stdout + indicating what is happening. + .. versionadded:: 4.0 The `concurrency` parameter. @@ -185,6 +189,9 @@ class Coverage: .. versionadded:: 5.3 The `source_pkgs` parameter. + .. versionadded:: 6.0 + The `messages` parameter. + """ # data_file=None means no disk file at all. data_file missing means # use the value from the config file. @@ -205,6 +212,7 @@ class Coverage: self._warn_unimported_source = True self._warn_preimported_source = check_preimported self._no_warn_slugs = None + self._messages = messages # A record of all the warnings that have been issued. self._warnings = [] @@ -372,6 +380,11 @@ class Coverage: if once: self._no_warn_slugs.append(slug) + def _message(self, msg): + """Write a message to the user, if configured to do so.""" + if self._messages: + print(msg) + def get_option(self, option_name): """Get an option from the configuration. @@ -969,7 +982,8 @@ class Coverage: html_skip_empty=skip_empty, precision=precision, ): reporter = HtmlReporter(self) - return reporter.report(morfs) + ret = reporter.report(morfs) + return ret def xml_report( self, morfs=None, outfile=None, ignore_errors=None, diff --git a/coverage/html.py b/coverage/html.py index 15f35a66..95e3aa44 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -363,7 +363,9 @@ class HtmlReporter: 'totals': self.totals, }) - write_html(os.path.join(self.directory, "index.html"), html) + index_file = os.path.join(self.directory, "index.html") + write_html(index_file, html) + self.coverage._message(f"Wrote HTML report to {index_file}") # Write the latest hashes for next time. self.incr.write() |