MCPcopy
hub / github.com/pytest-dev/pytest / _get_direct_parametrize_args

Function _get_direct_parametrize_args

src/_pytest/fixtures.py:1653–1674  ·  view source on GitHub ↗

Return all direct parametrization arguments of a node, so we don't mistake them for fixtures. Check https://github.com/pytest-dev/pytest/issues/5036. These things are done later as well when dealing with parametrization so this could be improved.

(node: nodes.Node)

Source from the content-addressed store, hash-verified

1651
1652
1653def _get_direct_parametrize_args(node: nodes.Node) -> set[str]:
1654 """Return all direct parametrization arguments of a node, so we don't
1655 mistake them for fixtures.
1656
1657 Check https://github.com/pytest-dev/pytest/issues/5036.
1658
1659 These things are done later as well when dealing with parametrization
1660 so this could be improved.
1661 """
1662 parametrize_argnames: set[str] = set()
1663 for marker in node.iter_markers(name="parametrize"):
1664 indirect = marker.kwargs.get("indirect", False)
1665 p_argnames, _ = ParameterSet._parse_parametrize_args(
1666 *marker.args, **marker.kwargs
1667 )
1668 p_directness = _resolve_args_directness(p_argnames, indirect, node.nodeid)
1669 parametrize_argnames.update(
1670 argname
1671 for argname, directness in p_directness.items()
1672 if directness == "direct"
1673 )
1674 return parametrize_argnames
1675
1676
1677def deduplicate_names(*seqs: Iterable[str]) -> tuple[str, ...]:

Callers 1

getfixtureinfoMethod · 0.85

Calls 5

_resolve_args_directnessFunction · 0.85
iter_markersMethod · 0.80
updateMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected