-
-
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
PyTest won't inject fixtures into decorated functions in Python 2.7 #2782
Comments
I believe this is because of a limitation in Python 2's |
Well, yes, |
i recall six has a fixed version, also you can just put the |
It can by solved by either using What is the preferred general solution to this? |
@kchomski-reef using six is the preferred solution as the guess abut what closure cell to use is potentially incorrect in edge cases |
can this be closed as upstream python issue fixed by six? |
There's nothing we can reliably do about this otherwise, so I'm happy to close as "Use six or upgrade to Python3" 🐍🐍🐍 |
Link state monitoring is used to detect link state changes while executing apply changes. In particular, to detect links that change to anything but UP. In order to allow simpler usage in selected tests, a decorator is introduced in addition to the existing context-manager. Note: six is used to overcome functools.wraps limitations with pytest (pytest-dev/pytest#2782) Signed-off-by: Edward Haas <edwardh@redhat.com>
Link state monitoring is used to detect link state changes while executing apply changes. In particular, to detect links that change to anything but UP. In order to allow simpler usage in selected tests, a decorator is introduced in addition to the existing context-manager. Note: six is used to overcome functools.wraps limitations with pytest (pytest-dev/pytest#2782) Signed-off-by: Edward Haas <edwardh@redhat.com>
Link state monitoring is used to detect link state changes while executing apply changes. In particular, to detect links that change to anything but UP. In order to allow simpler usage in selected tests, a decorator is introduced in addition to the existing context-manager. Note: six is used to overcome functools.wraps limitations with pytest (pytest-dev/pytest#2782) Signed-off-by: Edward Haas <edwardh@redhat.com>
In using snapshot decorator with pytest tests with fixtures, a TypeError error is raised. This is due to a known limitation of functools.wraps with Python 2.7 and pytest: pytest-dev/pytest#2782. This fix uses wrapt.decorator instead. * fix snapshot decorator for pytest fixtures * flush before starting snapshot
_pytest.compat.get_real_func
doesn't work as expected in Python 2.7:Example:
Python 3.5 output:
Python 2.7 output:
Tested with PyTest 3.0.6 though the same idea (
isinstance(obj, functools.partial)
) is attempted inmaster
.The text was updated successfully, but these errors were encountered: