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

Function _get_first_non_fixture_func

src/_pytest/python.py:772–779  ·  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

770
771
772def _get_first_non_fixture_func(obj: object, names: Iterable[str]) -> Optional[object]:
773 """Return the attribute from the given object to be used as a setup/teardown
774 xunit-style function, but only if not marked as a fixture to avoid calling it twice."""
775 for name in names:
776 meth: Optional[object] = getattr(obj, name, None)
777 if meth is not None and fixtures.getfixturemarker(meth) is None:
778 return meth
779 return None
780
781
782class Class(PyCollector):

Callers 5

setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected