Skip to content

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

Merged

Conversation

stanislavlevin
Copy link
Contributor

@stanislavlevin stanislavlevin commented May 7, 2020

'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

'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]>
bmwiedemann added a commit to bmwiedemann/openSUSE that referenced this pull request May 28, 2020
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)
@webknjaz
Copy link
Member

webknjaz commented Jun 2, 2020

@RonnyPfannschmidt looks like I hit it too while trying to debug #33. It seems mergeable.

@RonnyPfannschmidt RonnyPfannschmidt merged commit 74b3e8b into pytest-dev:master Jun 2, 2020
@RonnyPfannschmidt
Copy link
Member

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)
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'Function' object has no attribute '_getfslineno'
3 participants