@@ -1363,9 +1363,9 @@ def parametrize(
1363
1363
name2pseudofixturedef = node .stash .setdefault (
1364
1364
name2pseudofixturedef_key , default
1365
1365
)
1366
- arg_values_types = self ._resolve_arg_value_types (argnames , indirect )
1366
+ arg_directness = self ._resolve_args_directness (argnames , indirect )
1367
1367
for argname in argnames :
1368
- if arg_values_types [argname ] == "params " :
1368
+ if arg_directness [argname ] == "indirect " :
1369
1369
continue
1370
1370
if name2pseudofixturedef is not None and argname in name2pseudofixturedef :
1371
1371
fixturedef = name2pseudofixturedef [argname ]
@@ -1470,28 +1470,30 @@ def _validate_ids(
1470
1470
1471
1471
return list (itertools .islice (ids , num_ids ))
1472
1472
1473
- def _resolve_arg_value_types (
1473
+ def _resolve_args_directness (
1474
1474
self ,
1475
1475
argnames : Sequence [str ],
1476
1476
indirect : Union [bool , Sequence [str ]],
1477
- ) -> Dict [str , "Literal['params', 'funcargs']" ]:
1478
- """Resolve if each parametrized argument must be considered a
1479
- parameter to a fixture or a "funcarg" to the function, based on the
1480
- ``indirect`` parameter of the parametrized() call.
1477
+ ) -> Dict [str , Literal ["indirect" , "direct" ]]:
1478
+ """Resolve if each parametrized argument must be considered an indirect
1479
+ parameter to a fixture of the same name, or a direct parameter to the
1480
+ parametrized function, based on the ``indirect`` parameter of the
1481
+ parametrized() call.
1481
1482
1482
- :param List[str] argnames: List of argument names passed to ``parametrize()``.
1483
- :param indirect: Same as the ``indirect`` parameter of ``parametrize()``.
1484
- :rtype: Dict[str, str]
1485
- A dict mapping each arg name to either:
1486
- * "params" if the argname should be the parameter of a fixture of the same name.
1487
- * "funcargs" if the argname should be a parameter to the parametrized test function .
1483
+ :param argnames:
1484
+ List of argument names passed to ``parametrize()``.
1485
+ :param indirect:
1486
+ Same as the ``indirect`` parameter of ``parametrize()``.
1487
+ :returns
1488
+ A dict mapping each arg name to either "indirect" or "direct" .
1488
1489
"""
1490
+ arg_directness : Dict [str , Literal ["indirect" , "direct" ]]
1489
1491
if isinstance (indirect , bool ):
1490
- valtypes : Dict [ str , Literal [ "params" , "funcargs" ]] = dict .fromkeys (
1491
- argnames , "params " if indirect else "funcargs "
1492
+ arg_directness = dict .fromkeys (
1493
+ argnames , "indirect " if indirect else "direct "
1492
1494
)
1493
1495
elif isinstance (indirect , Sequence ):
1494
- valtypes = dict .fromkeys (argnames , "funcargs " )
1496
+ arg_directness = dict .fromkeys (argnames , "direct " )
1495
1497
for arg in indirect :
1496
1498
if arg not in argnames :
1497
1499
fail (
@@ -1500,15 +1502,15 @@ def _resolve_arg_value_types(
1500
1502
),
1501
1503
pytrace = False ,
1502
1504
)
1503
- valtypes [arg ] = "params "
1505
+ arg_directness [arg ] = "indirect "
1504
1506
else :
1505
1507
fail (
1506
1508
"In {func}: expected Sequence or boolean for indirect, got {type}" .format (
1507
1509
type = type (indirect ).__name__ , func = self .function .__name__
1508
1510
),
1509
1511
pytrace = False ,
1510
1512
)
1511
- return valtypes
1513
+ return arg_directness
1512
1514
1513
1515
def _validate_if_using_arg_names (
1514
1516
self ,
0 commit comments