Skip to content
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

Improve lookup/request to allow access to class instances from staticfunctions #3720

Closed
nicoddemus opened this issue Jul 26, 2018 · 1 comment · Fixed by #3754
Closed

Improve lookup/request to allow access to class instances from staticfunctions #3720

nicoddemus opened this issue Jul 26, 2018 · 1 comment · Fixed by #3754
Labels
topic: fixtures anything involving fixtures directly or indirectly type: refactoring internal improvements to the code

Comments

@nicoddemus
Copy link
Member

Follow up from #3705 (comment)

We would like to cleanup the __being_called_by_pytest keyword hack that was used in #3705. @RonnyPfannschmidt's suggestion of unwrapping the fixture function just before the call works great, except that for staticmethods we don't have access to instance request at that point.

It seems like a deeper issue in the structural construction of the request: static test functions should still have self in request.instance.

@nicoddemus nicoddemus added type: refactoring internal improvements to the code topic: fixtures anything involving fixtures directly or indirectly labels Jul 26, 2018
@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #3359 (Allow methods to access a class fixture. ), #2138 (Accessing test instance object from pytest_runtest_makereport), #765 (Re-allow simple class::test selection via "-k"), #2270 (Question: writing a plugin with a fixture that can access its plugin instance properties), and #674 (Fixtures from methods wrongly get rebound to request.instance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: fixtures anything involving fixtures directly or indirectly type: refactoring internal improvements to the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants