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

fix fixture for python3 fixes #2334 #2814

Closed
wants to merge 2 commits into from

Conversation

ApaDoctor
Copy link
Contributor

@ApaDoctor ApaDoctor commented Oct 5, 2017

This is not the completed PR.
#2334
I discovered that problem exists because FixtureMaker creates additional attr in function object.
This attr is replaced each time we using it,
The solution is to copy function object when _pytestfixturefunction exists.
But function that im using to copy function is only for python3.

"class fixtures not supported (may be in the future)")
if getattr(function, "_pytestfixturefunction", False):
function = copy_func(function)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the assigment was reoved, as such this is broken

from my pov we should not copy the function but warn about the mistake reserving the right to fail later on

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that copying the function is dangerous. I think we can target features and raise an error if @pytest.fixture is being applied more than once to the same function.

It is clearly a problem and if it is working is mostly by accident.

@ApaDoctor
Copy link
Contributor Author

I create new PR providing these changes

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.

3 participants