MCPcopy Create free account
hub / github.com/pytest-dev/pytest / instance

Method instance

src/_pytest/fixtures.py:513–520  ·  view source on GitHub ↗

Instance (can be None) on which test function was collected.

(self)

Source from the content-addressed store, hash-verified

511
512 @property
513 def instance(self):
514 """Instance (can be None) on which test function was collected."""
515 # unittest support hack, see _pytest.unittest.TestCaseFunction.
516 try:
517 return self._pyfuncitem._testcase
518 except AttributeError:
519 function = getattr(self, "function", None)
520 return getattr(function, "__self__", None)
521
522 @property
523 def module(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected