Apply comments

This commit is contained in:
Sadra Barikbin 2023-08-02 11:58:33 +03:30
parent cd4a26a4c7
commit 5b7ebee350
2 changed files with 2 additions and 40 deletions

View File

@ -259,7 +259,7 @@ def get_parametrized_fixture_keys(
pass
else:
cs: CallSpec2 = callspec
# cs.indices.items() is random order of argnames. Need to
# cs.indices is random order of argnames. Need to
# sort this so that different calls to
# get_parametrized_fixture_keys will be deterministic.
for argname in sorted(cs.indices):
@ -270,7 +270,7 @@ def get_parametrized_fixture_keys(
if scope is Scope.Session:
scoped_item_path = None
elif scope is Scope.Package:
scoped_item_path = item.path.parent
scoped_item_path = item.path
elif scope is Scope.Module:
scoped_item_path = item.path
elif scope is Scope.Class:

View File

@ -4536,41 +4536,3 @@ def test_yield_fixture_with_no_value(pytester: Pytester) -> None:
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`."
)
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\]>",
]
)