diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-30 17:39:20 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-30 18:03:05 -0400 |
commit | 30c023b5b74f9c798645cbb3f35362ae046a4c25 (patch) | |
tree | e86df1a4c044ec9b2919068297dfd91a382eeb84 /coverage/inorout.py | |
parent | 22fe2eb167a18dda8fd3e14cbf9166a1c7331fb9 (diff) | |
download | python-coveragepy-git-30c023b5b74f9c798645cbb3f35362ae046a4c25.tar.gz |
feat: warnings are now real warnings
This makes coverage warnings visible when running test suites under
pytest. But it also means some uninteresting warnings would show up in
our own test suite, so we had to catch or suppress those.
Diffstat (limited to 'coverage/inorout.py')
-rw-r--r-- | coverage/inorout.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py index fae9ef18..32eb9079 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -356,10 +356,9 @@ class InOrOut: ) break except Exception: - self.warn( - "Disabling plug-in %r due to an exception:" % (plugin._coverage_plugin_name) - ) - traceback.print_exc() + plugin_name = plugin._coverage_plugin_name + tb = traceback.format_exc() + self.warn(f"Disabling plug-in {plugin_name!r} due to an exception:\n{tb}") plugin._coverage_enabled = False continue else: @@ -503,10 +502,8 @@ class InOrOut: # The module was in sys.modules, and seems like a module with code, but # we never measured it. I guess that means it was imported before # coverage even started. - self.warn( - "Module %s was previously imported, but not measured" % pkg, - slug="module-not-measured", - ) + msg = f"Module {pkg} was previously imported, but not measured" + self.warn(msg, slug="module-not-measured") def find_possibly_unexecuted_files(self): """Find files in the areas of interest that might be untraced. |