I've had a number of times where I've done the following:
# code
m. with open(somefile, modes) as data_interface:
.. ...
n. ...
And then when trying to provide test coverage using python's coverage module it complains about missing a branch on the from the line where the 'with' is (line 'm') to the line after the block (line n).
I have yet to figure out how to get coverage to recognize the branch is not an issue. I eventually just go back to using the open() call without the context manager; but I would really prefer to keep using it within a context manager.
Ideas?