File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""
2+ .. warning::
3+
4+ This plugin is now deprecated.
5+
26Use 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
1115Then, you can enable coverage reporting with :
3135
3236import io
3337import logging
38+ import sys
3439
3540from 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
You can’t perform that action at this time.
0 commit comments