-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Different interaction between fixtures, functools.wraps and default arguments in python 2 and 3 #677
Comments
python3 is correct, python2 has a bug in functools.wraps @DRMacIver where you the reporter? |
Yep, that was me. I'm no longer directly affected by this issue because I have a huge elaborate function wrapping infrastructure to work around it and some related things now. :-) |
Would you be willing to link to your elaborate function wrapping infrastructure? Perhaps it could help the devs fix this bug. :) |
closing this one as user code bug, python2 has a broken functools.wraps |
Now that we are using `pytest`, there is no need for a custom decorator because we can use `pytest.mark.skipif()`. This makes the code significantly simpler. In particular, dropping the custom `@kafka_versions()` decorator is necessary because it uses `func.wraps()` which doesn't play nice with `pytest` fixtures: - pytest-dev/pytest#677 - https://stackoverflow.com/a/19614807/770425 So this is a pre-requisite to migrating some of those tests to using pytest fixtures.
Now that we are using `pytest`, there is no need for a custom decorator because we can use `pytest.mark.skipif()`. This makes the code significantly simpler. In particular, dropping the custom `@kafka_versions()` decorator is necessary because it uses `func.wraps()` which doesn't play nice with `pytest` fixtures: - pytest-dev/pytest#677 - https://stackoverflow.com/a/19614807/770425 So this is a pre-requisite to migrating some of those tests to using pytest fixtures.
Originally reported by: David MacIver (BitBucket: david_maciver_, GitHub: david_maciver_)
In python 2 the addition of the default works: The test is called with x=1. In python 3 this looks for a fixture and errors with fixture 'x' not found.
Additionally, if I remove the wraps this works in both versions.
I'm not sure what the intended correct behaviour is, but having the behaviour be different between 2 or 3 sounds like a bug regardless of which one is correct.
The text was updated successfully, but these errors were encountered: