-
Notifications
You must be signed in to change notification settings - Fork 222
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
INTERNALERROR> IndexError: list index out of range #155
Comments
I've tried the fix in pytest-dev/pytest#1003 and that seems to work better:
I don't see why the second thing (decorating with |
This bug seems to come up whenever there's an error during collection. |
The original issue should be fixed in pytest 1.9 via pytest-dev/pytest#1414, but this issue still crops us for us because We're currently working around this by patching the # in conftest.py
import inspect
from functools import wraps
if not hasattr(inspect, '_orig_findsource'):
@wraps(inspect.findsource)
def findsource(*args, **kwargs):
try:
return inspect._orig_findsource(*args, **kwargs)
except IndexError:
raise IOError("Invalid line")
inspect._orig_findsource = inspect.findsource
inspect.findsource = findsource It would be nice to change pytest-bdd so that it doesn't need to modify the line numbers to avoid more problems like this. |
2021 still experiencing this. |
@rygwdn @antonalechnovic Do you have a reproducer for this? Like mentioned, I can't reproduce this with my original example since a long time. |
In 2022, similar error:
The error is thrown when using a decorator in the form of
where the |
I'm not sure if this is a
pytest-bdd
or a pytest core bug - but I've not seen it outside ofpytest-bdd
, so I'm reporting it here. Please let me know if I'm wrong! 😄I found various ways to trigger this exception - for example when using an undefined fixture in a bdd test.
feat.feature
:test_foo.py
:gives me:
I also see this with Python 3.4 and pytest 2.7.
I can also reproduce it by decorating a fixture with
@bdd.given
and@bdd.when
- same feature file as above, with thistest_foo.py
:The text was updated successfully, but these errors were encountered: