Skip to content

Commit dd38013

Browse files
authored
Merge pull request #652 from nose-devs/deprecate-coverage-plugin
Deprecate the coverage plugin
2 parents eedc66f + 8c37700 commit dd38013

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

nose2/plugins/coverage.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
"""
2+
.. warning::
3+
4+
This plugin is now deprecated.
5+
26
Use this plugin to activate coverage report.
37
4-
To use this plugin, you need to install ``nose2[coverage_plugin]``. e.g.
8+
To use this plugin, you need to install ``coverage``. e.g.
59
610
::
711
8-
$ pip install nose2[coverage_plugin]>=0.6.5
12+
$ pip install nose2 coverage
913
1014
1115
Then, you can enable coverage reporting with :
@@ -31,6 +35,7 @@
3135

3236
import io
3337
import logging
38+
import sys
3439

3540
from nose2.events import Plugin
3641

@@ -175,6 +180,23 @@ def afterSummaryReport(self, event):
175180
Now print any buffered error output saved from beforeSummaryReport"""
176181
print(self.error_output_buffer.getvalue(), file=event.stream)
177182

183+
# show a warning at the end of output (after any report)
184+
#
185+
# warnings are not emitted to the user inside of nose2, plus
186+
# DeprecationWarning is off by default -- for simplicity, just print
187+
# to stderr
188+
print(
189+
(
190+
"**********\n"
191+
"WARNING\n"
192+
"Support for the nose2 coverage plugin is gradually being removed. "
193+
"Use `coverage run nose` instead.\n\n"
194+
"For more detail, see https://github.com/nose-devs/nose2/issues/651"
195+
"\n**********"
196+
),
197+
file=sys.stderr,
198+
)
199+
178200
def _start_coverage(self):
179201
try:
180202
import coverage

0 commit comments

Comments
 (0)