New issue 553: Handle exceptions in inspect.getsourcelines() https://bitbucket.org/hpk42/pytest/issue/553/handle-exceptions-in-inspectgetsourcelines
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 "<string>", 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. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit