I want to create a decorator for my test written with pytest. My problem, when calling decorator, pytest raises an exception that decorator hasn't got parameters "test_params".
Decorator example:
def decorator_example(fn):
def create(*args, **kwargs):
# any code here
return fn(*args, **kwargs)
return create
Test example:
@pytest.mark.parametrize(
"test_params",
[
pytest.param("own_parameters")
])
@decorator_example
def test_1(self, fixture1, fixture2, test_params):
pass
And caught exception:
ValueError: <function create at address> uses no argument 'test_params'
How can I create a decorator which will be compatible with pytest's parametrized test?