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

Method cls

src/_pytest/fixtures.py:504–510  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

502
503 @property
504 def cls(self):
505 """Class (can be None) where the test function was collected."""
506 if self.scope not in ("class", "function"):
507 raise AttributeError(f"cls not available in {self.scope}-scoped context")
508 clscol = self._pyfuncitem.getparent(_pytest.python.Class)
509 if clscol:
510 return clscol.obj
511
512 @property
513 def instance(self):

Callers

nothing calls this directly

Calls 1

getparentMethod · 0.80

Tested by

no test coverage detected