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

Method __init__

src/_pytest/fixtures.py:817–853  ·  view source on GitHub ↗
(
        self,
        request: FixtureRequest,
        scope: Scope,
        param: Any,
        param_index: int,
        fixturedef: FixtureDef[object],
        *,
        _ispytest: bool = False,
    )

Source from the content-addressed store, hash-verified

815 (transitively) by a test function."""
816
817 def __init__(
818 self,
819 request: FixtureRequest,
820 scope: Scope,
821 param: Any,
822 param_index: int,
823 fixturedef: FixtureDef[object],
824 *,
825 _ispytest: bool = False,
826 ) -> None:
827 super().__init__(
828 pyfuncitem=request._pyfuncitem,
829 fixturename=fixturedef.argname,
830 fixture_defs=request._fixture_defs,
831 arg2fixturedefs=request._arg2fixturedefs,
832 _ispytest=_ispytest,
833 )
834 self._parent_request: Final[FixtureRequest] = request
835 self._fixturedef: Final[FixtureDef[object]] = fixturedef
836 if param is not NOTSET:
837 self.param = param
838 self.param_index: Final = param_index
839 self._scope_field: Final = scope
840 if scope is Scope.Function:
841 # This might also be a non-function Item despite its attribute name.
842 node: nodes.Node | None = self._pyfuncitem
843 elif scope is Scope.Package:
844 node = get_scope_package(self._pyfuncitem, self._fixturedef)
845 else:
846 node = get_scope_node(self._pyfuncitem, scope)
847 if node is None and scope is Scope.Class:
848 # Fallback to function item itself.
849 node = self._pyfuncitem
850 assert node, (
851 f'Could not obtain a node for scope "{scope}" for function {self._pyfuncitem!r}'
852 )
853 self._node: Final = node
854
855 def __repr__(self) -> str:
856 return f"<SubRequest {self.fixturename!r} for {self._pyfuncitem!r}>"

Callers

nothing calls this directly

Calls 3

get_scope_packageFunction · 0.85
get_scope_nodeFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected