You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally reported bylucasboppre (Bitbucket: lucasboppre, GitHub: Unknown)
It looks to me as if all branches have been taken, but coverage disagrees. Problem disappears with context manager is removed or value is returned directly.
#!python
def soft_read(filename):
try:
with open(filename, 'r') as f:
value = f.read() # line 4, partial coverage
except:
value = ''
return value
assert soft_read('missing file.txt') == ''
assert len(soft_read(__file__))
Original comment bylucasboppre (Bitbucket: lucasboppre, GitHub: Unknown)
Thanks! I checked all open issues for duplicates, and searched the closed ones, but couldn't find because I thought it had something to do with the try/except. Upgrading to beta fixed the problem (pip install --pre --upgrade coverage).
Originally reported by lucasboppre (Bitbucket: lucasboppre, GitHub: Unknown)
It looks to me as if all branches have been taken, but coverage disagrees. Problem disappears with context manager is removed or value is returned directly.
Line 4 was executed, but never jumped to line 5
The text was updated successfully, but these errors were encountered: