diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-04-14 10:42:16 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-04-14 10:42:16 -0400 |
commit | c2284d65bdb56cd1eb56c3e53228892824189732 (patch) | |
tree | c1e72b9c9a3ec09c55fd28f13af79e0556673465 /test/test_coverage.py | |
parent | 030fa036e592c3336da512a37945c3b0d0ac701e (diff) | |
download | python-coveragepy-git-c2284d65bdb56cd1eb56c3e53228892824189732.tar.gz |
It's ok to ask the data module about files that were never measured. Fixes <<issue 2>>.
Diffstat (limited to 'test/test_coverage.py')
-rw-r--r-- | test/test_coverage.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_coverage.py b/test/test_coverage.py index 3fe3fe42..2974296d 100644 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -1786,6 +1786,30 @@ class ApiTests(CoverageTest): mycode3 7 4 57% 4-6 """)) + def testUnexecutedFile(self): + cov = coverage.coverage() + + self.makeFile("mycode", """\ + a = 1 + b = 2 + if b == 3: + c = 4 + d = 5 + """) + + self.makeFile("not_run", """\ + fooey = 17 + """) + + # Import the python file, executing it. + cov.start() + self.importModule("mycode") + cov.stop() + + filename, statements, missing, readablemissing = cov.analysis("not_run.py") + self.assertEqual(statements, [1]) + self.assertEqual(missing, [1]) + class CmdLineTests(CoverageTest): def help_fn(self, error=None): @@ -1937,3 +1961,4 @@ if __name__ == '__main__': # in an expression!) # TODO: Generator comprehensions? # TODO: Constant if tests ("if 1:"). Py 2.4 doesn't execute them. +# TODO: There are no tests for analysis2 directly.
\ No newline at end of file |