Calculate the :class:`FuncFixtureInfo` for an item. If ``func`` is None, or if the item sets an attribute ``nofuncargs = True``, then ``func`` is not examined at all. :param node: The item requesting the fixtures. :param func: The item's func
(
self,
node: nodes.Item,
func: Callable[..., object] | None,
cls: type | None,
)
| 1738 | self._flush_pending_conftests_to_session(session) |
| 1739 | |
| 1740 | def getfixtureinfo( |
| 1741 | self, |
| 1742 | node: nodes.Item, |
| 1743 | func: Callable[..., object] | None, |
| 1744 | cls: type | None, |
| 1745 | ) -> FuncFixtureInfo: |
| 1746 | """Calculate the :class:`FuncFixtureInfo` for an item. |
| 1747 | |
| 1748 | If ``func`` is None, or if the item sets an attribute |
| 1749 | ``nofuncargs = True``, then ``func`` is not examined at all. |
| 1750 | |
| 1751 | :param node: |
| 1752 | The item requesting the fixtures. |
| 1753 | :param func: |
| 1754 | The item's function. |
| 1755 | :param cls: |
| 1756 | If the function is a method, the method's class. |
| 1757 | """ |
| 1758 | if func is not None and not getattr(node, "nofuncargs", False): |
| 1759 | argnames = getfuncargnames(func, name=node.name, cls=cls) |
| 1760 | else: |
| 1761 | argnames = () |
| 1762 | usefixturesnames = self._getusefixturesnames(node) |
| 1763 | autousenames = self._getautousenames(node) |
| 1764 | initialnames = deduplicate_names(autousenames, usefixturesnames, argnames) |
| 1765 | |
| 1766 | direct_parametrize_args = _get_direct_parametrize_args(node) |
| 1767 | |
| 1768 | names_closure, arg2fixturedefs = self.getfixtureclosure( |
| 1769 | parentnode=node, |
| 1770 | initialnames=initialnames, |
| 1771 | ignore_args=direct_parametrize_args, |
| 1772 | ) |
| 1773 | |
| 1774 | return FuncFixtureInfo(argnames, initialnames, names_closure, arg2fixturedefs) |
| 1775 | |
| 1776 | def pytest_plugin_registered(self, plugin: _PluggyPlugin, plugin_name: str) -> None: |
| 1777 | # Fixtures defined in conftest plugins are only visible to within the |