88from collections import deque
99from contextlib import suppress
1010from pathlib import Path
11+ from typing import AbstractSet
1112from typing import Any
1213from typing import Callable
1314from typing import cast
@@ -1382,7 +1383,7 @@ def pytest_addoption(parser: Parser) -> None:
13821383 )
13831384
13841385
1385- def _get_direct_parametrize_args (node : nodes .Node ) -> List [str ]:
1386+ def _get_direct_parametrize_args (node : nodes .Node ) -> Set [str ]:
13861387 """Return all direct parametrization arguments of a node, so we don't
13871388 mistake them for fixtures.
13881389
@@ -1391,14 +1392,13 @@ def _get_direct_parametrize_args(node: nodes.Node) -> List[str]:
13911392 These things are done later as well when dealing with parametrization
13921393 so this could be improved.
13931394 """
1394- parametrize_argnames : List [str ] = []
1395+ parametrize_argnames : Set [str ] = set ()
13951396 for marker in node .iter_markers (name = "parametrize" ):
13961397 if not marker .kwargs .get ("indirect" , False ):
13971398 p_argnames , _ = ParameterSet ._parse_parametrize_args (
13981399 * marker .args , ** marker .kwargs
13991400 )
1400- parametrize_argnames .extend (p_argnames )
1401-
1401+ parametrize_argnames .update (p_argnames )
14021402 return parametrize_argnames
14031403
14041404
@@ -1519,7 +1519,7 @@ def getfixtureclosure(
15191519 self ,
15201520 fixturenames : Tuple [str , ...],
15211521 parentnode : nodes .Node ,
1522- ignore_args : Sequence [str ] = () ,
1522+ ignore_args : AbstractSet [str ],
15231523 ) -> Tuple [Tuple [str , ...], List [str ], Dict [str , Sequence [FixtureDef [Any ]]]]:
15241524 # Collect the closure of all fixtures, starting with the given
15251525 # fixturenames as the initial set. As we have to visit all
0 commit comments