Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
sadra-barikbin committed Jul 19, 2023
1 parent 4b6d2fb commit 59a848c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions testing/python/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4536,3 +4536,41 @@ def test_fixt(custom):
result.assert_outcomes(errors=1)
result.stdout.fnmatch_lines([expected])
assert result.ret == ExitCode.TESTS_FAILED


@pytest.mark.xfail(
reason="It isn't differentiated between direct `fixture` param and fixture `fixture`. Will be "
"solved by adding `baseid` to `FixtureArgKey` and baseing fixture keys on param values rather than indices."
)
def test_reorder_with_high_scoped_direct_and_fixture_parametrization(
pytester: Pytester,
):
pytester.makepyfile(
"""
import pytest
@pytest.fixture(params=[0, 1], scope='module')
def fixture(request):
pass
def test_1(fixture):
pass
def test_2():
pass
@pytest.mark.parametrize("fixture", [1, 2], scope='module')
def test_3(fixture):
pass
"""
)
result = pytester.runpytest("--collect-only")
result.stdout.re_match_lines(
[
r" <Function test_1\[0\]>",
r" <Function test_1\[1\]>",
r" <Function test_2>",
r" <Function test_3\[1\]>",
r" <Function test_3\[2\]>",
]
)

0 comments on commit 59a848c

Please sign in to comment.