Skip to content

Commit 62489d0

Browse files
committed
A test to prove that the fix for #224 causes problems of its own.
1 parent 0801081 commit 62489d0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/test_process.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)