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

Method cls

src/_pytest/fixtures.py:527–533  ·  view source on GitHub ↗

Class (can be None) where the test function was collected.

(self)

Source from the content-addressed store, hash-verified

525
526 @property
527 def cls(self):
528 """Class (can be None) where the test function was collected."""
529 if self.scope not in ("class", "function"):
530 raise AttributeError(f"cls not available in {self.scope}-scoped context")
531 clscol = self._pyfuncitem.getparent(_pytest.python.Class)
532 if clscol:
533 return clscol.obj
534
535 @property
536 def instance(self):

Callers

nothing calls this directly

Calls 1

getparentMethod · 0.80

Tested by

no test coverage detected