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

Method __init__

src/_pytest/fixtures.py:1387–1407  ·  view source on GitHub ↗
(
        self,
        *,
        function: Callable[..., Any],
        fixture_function_marker: FixtureFunctionMarker,
        instance: object | None = None,
        _ispytest: bool = False,
    )

Source from the content-addressed store, hash-verified

1385# TODO: paramspec/return type annotation tracking and storing
1386class FixtureFunctionDefinition:
1387 def __init__(
1388 self,
1389 *,
1390 function: Callable[..., Any],
1391 fixture_function_marker: FixtureFunctionMarker,
1392 instance: object | None = None,
1393 _ispytest: bool = False,
1394 ) -> None:
1395 check_ispytest(_ispytest)
1396 self.name = fixture_function_marker.name or function.__name__
1397 # In order to show the function that this fixture contains in messages.
1398 # Set the __name__ to be same as the function __name__ or the given fixture name.
1399 self.__name__ = self.name
1400 self._fixture_function_marker = fixture_function_marker
1401 if instance is not None:
1402 self._fixture_function = cast(
1403 Callable[..., Any], function.__get__(instance)
1404 )
1405 else:
1406 self._fixture_function = function
1407 functools.update_wrapper(self, function)
1408
1409 def __repr__(self) -> str:
1410 return f"<pytest_fixture({self._fixture_function})>"

Callers

nothing calls this directly

Calls 2

check_ispytestFunction · 0.90
__get__Method · 0.80

Tested by

no test coverage detected