-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle exceptions in inspect.getsourcelines() #553
Labels
type: bug
problem that needs to be addressed
Comments
Original comment by Bruno Oliveira (BitBucket: nicoddemus, GitHub: nicoddemus): Handle inspect.getsourcelines failures in FixtureLookupError Fixes #553 |
1 similar comment
Original comment by Bruno Oliveira (BitBucket: nicoddemus, GitHub: nicoddemus): Handle inspect.getsourcelines failures in FixtureLookupError Fixes #553 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally reported by: BitBucket: talljosh, GitHub: talljosh
FixtureLookupError uses inspect.getsourcelines() in its formatting, but inspect.getsourcelines() can raise an IOError, which is not handled. This results in the FixtureLookupError being masked by the IOError, which is confusing and unhelpful.
The actual circumstance in which I saw this involved a function decorated with pytest.inlineCallbacks from the pytest-twisted plugin. The decorated function has a filename of "", which stops inspect from being able to find the source code. Although this may be considered to be an issue with the pytest-twisted plugin (or the decorator module which it uses), it would be nice for pytest to actually handle these kinds of exceptions neatly.
I have attached a proposed patch.
The text was updated successfully, but these errors were encountered: