diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-08-10 08:03:45 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-08-10 08:03:45 -0400 |
commit | fd70e78bae72dd09d35ec305e75d9e5fb4a416c5 (patch) | |
tree | 09988fe0a5f62bb611fbe6ae6a91ab4c517cec32 | |
parent | 1966f545699490822117d66a86f2de91734a6ee9 (diff) | |
download | python-coveragepy-fd70e78bae72dd09d35ec305e75d9e5fb4a416c5.tar.gz |
The for-else fix also fixed 'with' statements, and therefore, issue #128.
-rw-r--r-- | CHANGES.txt | 3 | ||||
-rw-r--r-- | test/test_arcs.py | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 8765dc1..7bef01f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,8 @@ Version 3.5.1 - for-else constructs are understood better, and don't cause erroneous partial branch warnings. Fixes `issue 122`_. +- Branch coverage for ``with`` statements is improved, fixing `issue 128`_. + - The number of partial branches reported on the HTML summary page was different than the number reported on the individual file pages. This is now fixed. @@ -23,6 +25,7 @@ Version 3.5.1 See the fullcoverage directory if you are interested. .. _issue 122: http://bitbucket.org/ned/coveragepy/issue/122/for-else-always-reports-missing-branch +.. _issue 128: https://bitbucket.org/ned/coveragepy/issue/128/branch-coverage-of-with-statement-in-27 .. _issue 138: https://bitbucket.org/ned/coveragepy/issue/138/include-should-take-precedence-over-is diff --git a/test/test_arcs.py b/test/test_arcs.py index 2c98317..050961f 100644 --- a/test/test_arcs.py +++ b/test/test_arcs.py @@ -143,6 +143,22 @@ class SimpleArcTest(CoverageTest): ) +class WithTest(CoverageTest): + """Arc-measuring tests involving context managers.""" + + def test_with(self): + self.check_coverage("""\ + def example(): + with open("test", "w") as f: # exit + f.write("") + return 1 + + example() + """, + arcz=".1 .2 23 34 4. 16 6." + ) + + class LoopArcTest(CoverageTest): """Arc-measuring tests involving loops.""" |