summaryrefslogtreecommitdiff
path: root/tests
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
commit045e69281e6858041f43fe4dbbaa496ddcd34e31 (patch)
treef6ec8ef257cf2040d4a29386ee9d5b906b403add /tests
parente3da86017869fd3c6836f36a25582339400a0514 (diff)
downloadpython-coveragepy-045e69281e6858041f43fe4dbbaa496ddcd34e31.tar.gz
Give a reasonable warning for a previous assert. Closes #353.
Diffstat (limited to 'tests')
-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 a1c853d..43fdc1b 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."""