Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/pytest_cov/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Coverage plugin for pytest."""
import os
import warnings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be made conditional (if pytest.__version__ >= '3.8':).


import pytest
import argparse
Expand Down Expand Up @@ -234,7 +235,7 @@ def pytest_runtestloop(self, session):
message = 'Failed to generate report: %s\n' % exc
session.config.pluginmanager.getplugin("terminalreporter").write(
'WARNING: %s\n' % message, red=True, bold=True)
session.config.warn(code='COV-2', message=message)
warnings.warn(code='COV-2', message=message)
self.cov_total = 0
assert self.cov_total is not None, 'Test coverage should never be `None`'
if self._failed_cov_total():
Expand All @@ -245,7 +246,7 @@ def pytest_terminal_summary(self, terminalreporter):
if self._disabled:
message = 'Coverage disabled via --no-cov switch!'
terminalreporter.write('WARNING: %s\n' % message, red=True, bold=True)
terminalreporter.config.warn(code='COV-1', message=message)
warnings.warn(code='COV-1', message=message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

return
if self.cov_controller is None:
return
Expand Down