fixtures: remove `getfixtureinfo(funcargs)` in favor of None `func`
Since we already broke plugins using this (private) interface in this version (pytest-play, pytest-wdl), might as well do a cleanup.
This commit is contained in:
parent
48b0395648
commit
b3a981d385
|
@ -592,14 +592,9 @@ class DoctestModule(Module):
|
||||||
def _setup_fixtures(doctest_item: DoctestItem) -> TopRequest:
|
def _setup_fixtures(doctest_item: DoctestItem) -> TopRequest:
|
||||||
"""Used by DoctestTextfile and DoctestItem to setup fixture information."""
|
"""Used by DoctestTextfile and DoctestItem to setup fixture information."""
|
||||||
|
|
||||||
def func() -> None:
|
|
||||||
pass
|
|
||||||
|
|
||||||
doctest_item.funcargs = {} # type: ignore[attr-defined]
|
doctest_item.funcargs = {} # type: ignore[attr-defined]
|
||||||
fm = doctest_item.session._fixturemanager
|
fm = doctest_item.session._fixturemanager
|
||||||
fixtureinfo = fm.getfixtureinfo(
|
fixtureinfo = fm.getfixtureinfo(node=doctest_item, func=None, cls=None)
|
||||||
node=doctest_item, func=func, cls=None, funcargs=False
|
|
||||||
)
|
|
||||||
doctest_item._fixtureinfo = fixtureinfo # type: ignore[attr-defined]
|
doctest_item._fixtureinfo = fixtureinfo # type: ignore[attr-defined]
|
||||||
doctest_item.fixturenames = fixtureinfo.names_closure # type: ignore[attr-defined]
|
doctest_item.fixturenames = fixtureinfo.names_closure # type: ignore[attr-defined]
|
||||||
fixture_request = TopRequest(doctest_item, _ispytest=True) # type: ignore[arg-type]
|
fixture_request = TopRequest(doctest_item, _ispytest=True) # type: ignore[arg-type]
|
||||||
|
|
|
@ -1460,13 +1460,12 @@ class FixtureManager:
|
||||||
def getfixtureinfo(
|
def getfixtureinfo(
|
||||||
self,
|
self,
|
||||||
node: nodes.Item,
|
node: nodes.Item,
|
||||||
func: Callable[..., object],
|
func: Optional[Callable[..., object]],
|
||||||
cls: Optional[type],
|
cls: Optional[type],
|
||||||
funcargs: bool = True,
|
|
||||||
) -> FuncFixtureInfo:
|
) -> FuncFixtureInfo:
|
||||||
"""Calculate the :class:`FuncFixtureInfo` for an item.
|
"""Calculate the :class:`FuncFixtureInfo` for an item.
|
||||||
|
|
||||||
If ``funcargs`` is false, or if the item sets an attribute
|
If ``func`` is None, or if the item sets an attribute
|
||||||
``nofuncargs = True``, then ``func`` is not examined at all.
|
``nofuncargs = True``, then ``func`` is not examined at all.
|
||||||
|
|
||||||
:param node:
|
:param node:
|
||||||
|
@ -1475,10 +1474,8 @@ class FixtureManager:
|
||||||
The item's function.
|
The item's function.
|
||||||
:param cls:
|
:param cls:
|
||||||
If the function is a method, the method's class.
|
If the function is a method, the method's class.
|
||||||
:param funcargs:
|
|
||||||
Whether to look into func's parameters as fixture requests.
|
|
||||||
"""
|
"""
|
||||||
if funcargs and not getattr(node, "nofuncargs", False):
|
if func is not None and not getattr(node, "nofuncargs", False):
|
||||||
argnames = getfuncargnames(func, name=node.name, cls=cls)
|
argnames = getfuncargnames(func, name=node.name, cls=cls)
|
||||||
else:
|
else:
|
||||||
argnames = ()
|
argnames = ()
|
||||||
|
|
|
@ -1800,9 +1800,8 @@ class Function(PyobjMixin, nodes.Item):
|
||||||
self.keywords.update(keywords)
|
self.keywords.update(keywords)
|
||||||
|
|
||||||
if fixtureinfo is None:
|
if fixtureinfo is None:
|
||||||
fixtureinfo = self.session._fixturemanager.getfixtureinfo(
|
fm = self.session._fixturemanager
|
||||||
self, self.obj, self.cls, funcargs=True
|
fixtureinfo = fm.getfixtureinfo(self, self.obj, self.cls)
|
||||||
)
|
|
||||||
self._fixtureinfo: FuncFixtureInfo = fixtureinfo
|
self._fixtureinfo: FuncFixtureInfo = fixtureinfo
|
||||||
self.fixturenames = fixtureinfo.names_closure
|
self.fixturenames = fixtureinfo.names_closure
|
||||||
self._initrequest()
|
self._initrequest()
|
||||||
|
|
Loading…
Reference in New Issue