Skip to content

Commit a131cf2

Browse files
tsvikasionelmc
authored andcommitted
use TerminalReporter for first heading
1 parent 102fdc7 commit a131cf2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pytest_cov/plugin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
from coverage.results import display_covered
1212
from coverage.results import should_fail_under
1313

14+
try:
15+
from pytest import TerminalReporter # noqa: PT013
16+
except ImportError:
17+
from _pytest.terminal import TerminalReporter
18+
1419
from . import CovDisabledWarning
1520
from . import CovFailUnderWarning
1621
from . import CovReportWarning
@@ -333,7 +338,8 @@ def pytest_runtestloop(self, session):
333338
# it for unit tests that don't need it
334339
from coverage.misc import CoverageException
335340

336-
self.cov_controller.sep(self.cov_report, '=', 'coverage report')
341+
tr = TerminalReporter(session.config, self.cov_report)
342+
tr.write_sep('=', 'coverage report')
337343
try:
338344
self.cov_total = self.cov_controller.summary(self.cov_report)
339345
except CoverageException as exc:

0 commit comments

Comments
 (0)