[Pytest-commit] Issue #677: Different interaction between fixtures, functools.wraps and default arguments in python 2 and 3 (hpk42/pytest)
David MacIver
issues-reply at bitbucket.org
Sun Feb 8 13:14:28 CET 2015
New issue 677: Different interaction between fixtures, functools.wraps and default arguments in python 2 and 3
https://bitbucket.org/hpk42/pytest/issue/677/different-interaction-between-fixtures
David MacIver:
```
#!python
from functools import wraps
def add_default(f):
@wraps(f)
def hello(x=1):
return f(x)
return hello
@add_default
def test_hello(x):
assert x == 1
```
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.
More information about the pytest-commit
mailing list