File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,27 @@ def test_warnings(self):
396396 Coverage.py warning: No data was collected.
397397 """ ), out )
398398
399+ def test_warnings_during_reporting (self ):
400+ # While fixing issue #224, the warnings were being printed far too
401+ # often. Make sure they're not any more.
402+ self .make_file ("hello.py" , """\
403+ import sys, os, the_other
404+ print("Hello")
405+ """ )
406+ self .make_file ("the_other.py" , """\
407+ print("What?")
408+ """ )
409+ self .make_file (".coveragerc" , """\
410+ [run]
411+ source =
412+ .
413+ xyzzy
414+ """ )
415+
416+ self .run_command ("coverage run hello.py" )
417+ out = self .run_command ("coverage html" )
418+ self .assertEqual (out .count ("Module xyzzy was never imported." ), 0 )
419+
399420 def test_warnings_if_never_run (self ):
400421 out = self .run_command ("coverage run i_dont_exist.py" )
401422 self .assertIn ("No file to run: 'i_dont_exist.py'" , out )
You can’t perform that action at this time.
0 commit comments