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 | 7fb7094df42803bd1d0ca934a9f6e761d1a81da4 (patch) | |
tree | 9a51c8cfcfe0dcb7b1b9a3ad332dcdc55a3955d0 | |
parent | 829215d157dca64cd1d88be27908e73a084715a7 (diff) | |
download | python-coveragepy-git-7fb7094df42803bd1d0ca934a9f6e761d1a81da4.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 8765dc16..7bef01f2 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 2c983170..050961fa 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.""" |