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

Function _get_first_non_fixture_func

src/_pytest/python.py:735–743  ·  view source on GitHub ↗

Return the attribute from the given object to be used as a setup/teardown xunit-style function, but only if not marked as a fixture to avoid calling it twice.

(obj: object, names: Iterable[str])

Source from the content-addressed store, hash-verified

733
734
735def _get_first_non_fixture_func(obj: object, names: Iterable[str]) -> object | None:
736 """Return the attribute from the given object to be used as a setup/teardown
737 xunit-style function, but only if not marked as a fixture to avoid calling it twice.
738 """
739 for name in names:
740 meth: object | None = getattr(obj, name, None)
741 if meth is not None and fixtures.getfixturemarker(meth) is None:
742 return meth
743 return None
744
745
746class Class(PyCollector):

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…