Skip to content

Commit b8aae1f

Browse files
author
Sylvain MARIE
committed
Fixed bug with @pytest_fixture_plus when used in parametrized mode. Fixes #26
Added test.
1 parent 9c002fd commit b8aae1f

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

pytest_cases/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ def _get_arguments(*args, **kwargs):
364364
old_sig = signature(fixture_func)
365365
new_sig = remove_signature_parameters(old_sig, *old_parameter_names)
366366
# add them in reversed order so as to match the same test order than in pytest.
367-
new_sig = add_signature_parameters(new_sig, first=(Parameter(n, kind=Parameter.POSITIONAL_OR_KEYWORD)
368-
for n in reversed(new_parameter_names)))
367+
new_sig = add_signature_parameters(new_sig, first=tuple(Parameter(n, kind=Parameter.POSITIONAL_OR_KEYWORD)
368+
for n in reversed(new_parameter_names)))
369369

370370
# Finally create the fixture function, a wrapper of user-provided fixture with the new signature
371371
if not isgeneratorfunction(fixture_func):
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pytest_cases import pytest_fixture_plus
2+
import pytest
3+
4+
5+
@pytest_fixture_plus(scope="module")
6+
@pytest.mark.parametrize("arg1", [
7+
"one", "two"
8+
])
9+
@pytest.mark.parametrize("arg2", [
10+
"one", "two"
11+
])
12+
def myfix(arg1, arg2):
13+
return (arg1, arg2)
14+
15+
16+
def test_one(myfix):
17+
print(myfix)
18+

0 commit comments

Comments
 (0)