-
Notifications
You must be signed in to change notification settings - Fork 22
Add compatibility with Pytest 5.4.0+ #32
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
Add compatibility with Pytest 5.4.0+ #32
Conversation
'getfslineno' has been removed from 'compat' in Pytest [0]. However, that function was just the wrapper of '_pytest._code.source.getfslineno'. The latter exists in Pytest since, at least, 3.0.0. [0]: pytest-dev/pytest@9c7f1d9b3. Fixes: pytest-dev#30 Signed-off-by: Stanislav Levin <[email protected]>
https://build.opensuse.org/request/show/803983 by user mcepl + maxlin_factory - Add pytest5-compat.patch to make the test suite compatible with pytest 5.4.0+ (gh#pytest-dev/pytest-forked#32)
@RonnyPfannschmidt looks like I hit it too while trying to debug #33. It seems mergeable. |
merged, someone has to step up to do a release |
else: | ||
path, lineno = getfslineno(item) | ||
from _pytest._code.source import getfslineno | ||
path, lineno = getfslineno(item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR this returns path = ''
and lineno = -1
in my setup. Dunno if it's generally broken in pytest 5.4. It may need some extra investigation.
path, lineno = item._getfslineno() | ||
else: | ||
path, lineno = getfslineno(item) | ||
from _pytest._code.source import getfslineno |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been relocated to .code
27 days ago: https://github.com/pytest-dev/pytest/pull/7171/files#diff-ef66cddae564a1d8faabcab1bc4dccb4L282
But it's also accessible via __init__
so just removing .source
would "fix" it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its entirely possible this has been incorrect for years and was just missed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, before the mentioned relocation, it was correct.
'getfslineno' has been removed from 'compat' in Pytest [0].
However, that function was just the wrapper of
'_pytest._code.source.getfslineno'. The latter exists in Pytest
since, at least, 3.0.0.
[0]: pytest-dev/pytest@9c7f1d9b3.
Fixes: #30