non-branch line marked with partial branch coverage

Issue #362 duplicate
elmirjagudin created an issue

For this code:

#!/usr/bin/env python

def func(chunks):
    try:
    with open("data", "wb") as f:
            for chunk in chunks:
                f.write(chunk)
            print "done"

    except Exception as ex:
        pass

func(["hello", "bonjour"])

The coverage reports line 8 (print "done") as having partial branch coverage. See attached report. This feels wrong, as I don't se any way the print statment can branch.

It's probably something to do with the print statement is last statement in the 'try' block. Removing the try-expect around the code, make the partial branch coverage report to go away.

Comments (2)

  1. Log in to comment