Skip to content

Commit 59a848c

Browse files
Add a test
1 parent 4b6d2fb commit 59a848c

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

testing/python/fixtures.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,3 +4536,41 @@ def test_fixt(custom):
45364536
result.assert_outcomes(errors=1)
45374537
result.stdout.fnmatch_lines([expected])
45384538
assert result.ret == ExitCode.TESTS_FAILED
4539+
4540+
4541+
@pytest.mark.xfail(
4542+
reason="It isn't differentiated between direct `fixture` param and fixture `fixture`. Will be "
4543+
"solved by adding `baseid` to `FixtureArgKey` and baseing fixture keys on param values rather than indices."
4544+
)
4545+
def test_reorder_with_high_scoped_direct_and_fixture_parametrization(
4546+
pytester: Pytester,
4547+
):
4548+
pytester.makepyfile(
4549+
"""
4550+
import pytest
4551+
4552+
@pytest.fixture(params=[0, 1], scope='module')
4553+
def fixture(request):
4554+
pass
4555+
4556+
def test_1(fixture):
4557+
pass
4558+
4559+
def test_2():
4560+
pass
4561+
4562+
@pytest.mark.parametrize("fixture", [1, 2], scope='module')
4563+
def test_3(fixture):
4564+
pass
4565+
"""
4566+
)
4567+
result = pytester.runpytest("--collect-only")
4568+
result.stdout.re_match_lines(
4569+
[
4570+
r" <Function test_1\[0\]>",
4571+
r" <Function test_1\[1\]>",
4572+
r" <Function test_2>",
4573+
r" <Function test_3\[1\]>",
4574+
r" <Function test_3\[2\]>",
4575+
]
4576+
)

0 commit comments

Comments
 (0)