summaryrefslogtreecommitdiff
path: root/tests/test_process.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-01-26 22:01:18 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-01-26 22:01:18 -0500
commit068bbc3a6678ca4e4bb99d6b7178c67f4e258ddb (patch)
tree5b89bea47ad566fc2c5fcb2e932ae0ad811918a9 /tests/test_process.py
parent4dbcf7e66f0f83ce80c1384b7b34984348d9cdf3 (diff)
downloadpython-coveragepy-git-068bbc3a6678ca4e4bb99d6b7178c67f4e258ddb.tar.gz
Give a reasonable warning for a previous assert. Closes #353.
Diffstat (limited to 'tests/test_process.py')
-rw-r--r--tests/test_process.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_process.py b/tests/test_process.py
index a1c853d1..43fdc1bd 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -568,6 +568,31 @@ class ProcessTest(CoverageTest):
out = self.run_command("python allok.py")
self.assertEqual(out, "No warnings!\n")
+ def test_run_twice(self):
+ # https://bitbucket.org/ned/coveragepy/issue/353/40a3-introduces-an-unexpected-third-case
+ self.make_file("foo.py", """\
+ def foo():
+ pass
+ """)
+ self.make_file("run_twice.py", """\
+ import coverage
+
+ for _ in [1, 2]:
+ inst = coverage.Coverage(source=['foo'])
+ inst.load()
+ inst.start()
+ import foo
+ inst.stop()
+ inst.combine()
+ inst.save()
+ """)
+ out = self.run_command("python run_twice.py")
+ self.assertEqual(
+ out,
+ "Coverage.py warning: "
+ "Module foo was previously imported, but not measured.\n"
+ )
+
class AliasedCommandTest(CoverageTest):
"""Tests of the version-specific command aliases."""