diff options
-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.""" |