8
8
from collections import deque
9
9
from contextlib import suppress
10
10
from pathlib import Path
11
+ from typing import AbstractSet
11
12
from typing import Any
12
13
from typing import Callable
13
14
from typing import cast
@@ -1382,7 +1383,7 @@ def pytest_addoption(parser: Parser) -> None:
1382
1383
)
1383
1384
1384
1385
1385
- def _get_direct_parametrize_args (node : nodes .Node ) -> List [str ]:
1386
+ def _get_direct_parametrize_args (node : nodes .Node ) -> Set [str ]:
1386
1387
"""Return all direct parametrization arguments of a node, so we don't
1387
1388
mistake them for fixtures.
1388
1389
@@ -1391,14 +1392,13 @@ def _get_direct_parametrize_args(node: nodes.Node) -> List[str]:
1391
1392
These things are done later as well when dealing with parametrization
1392
1393
so this could be improved.
1393
1394
"""
1394
- parametrize_argnames : List [str ] = []
1395
+ parametrize_argnames : Set [str ] = set ()
1395
1396
for marker in node .iter_markers (name = "parametrize" ):
1396
1397
if not marker .kwargs .get ("indirect" , False ):
1397
1398
p_argnames , _ = ParameterSet ._parse_parametrize_args (
1398
1399
* marker .args , ** marker .kwargs
1399
1400
)
1400
- parametrize_argnames .extend (p_argnames )
1401
-
1401
+ parametrize_argnames .update (p_argnames )
1402
1402
return parametrize_argnames
1403
1403
1404
1404
@@ -1519,7 +1519,7 @@ def getfixtureclosure(
1519
1519
self ,
1520
1520
fixturenames : Tuple [str , ...],
1521
1521
parentnode : nodes .Node ,
1522
- ignore_args : Sequence [str ] = () ,
1522
+ ignore_args : AbstractSet [str ],
1523
1523
) -> Tuple [Tuple [str , ...], List [str ], Dict [str , Sequence [FixtureDef [Any ]]]]:
1524
1524
# Collect the closure of all fixtures, starting with the given
1525
1525
# fixturenames as the initial set. As we have to visit all
0 commit comments