fixtures: clean up getfixtureclosure()

Some code cleanups - no functional changes.
This commit is contained in:
Sadra Barikbin
2023-09-04 23:44:49 +03:00
committed by Ran Benita
parent 9c11275553
commit 48b0395648
2 changed files with 36 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ from pathlib import Path
import pytest
from _pytest.compat import getfuncargnames
from _pytest.config import ExitCode
from _pytest.fixtures import deduplicate_names
from _pytest.fixtures import TopRequest
from _pytest.monkeypatch import MonkeyPatch
from _pytest.pytester import get_public_names
@@ -4531,3 +4532,10 @@ 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
def test_deduplicate_names() -> None:
items = deduplicate_names("abacd")
assert items == ("a", "b", "c", "d")
items = deduplicate_names(items + ("g", "f", "g", "e", "b"))
assert items == ("a", "b", "c", "d", "g", "f", "e")