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

Method addfinalizer

src/_pytest/fixtures.py:547–551  ·  view source on GitHub ↗

Add finalizer/teardown function to be called after the last test within the requesting test context finished execution.

(self, finalizer: Callable[[], object])

Source from the content-addressed store, hash-verified

545 return self._pyfuncitem.session # type: ignore[no-any-return]
546
547 def addfinalizer(self, finalizer: Callable[[], object]) -> None:
548 """Add finalizer/teardown function to be called after the last test
549 within the requesting test context finished execution."""
550 # XXX usually this method is shadowed by fixturedef specific ones.
551 self._addfinalizer(finalizer, scope=self.scope)
552
553 def _addfinalizer(self, finalizer: Callable[[], object], scope) -> None:
554 node = self._getscopeitem(scope)

Callers

nothing calls this directly

Calls 1

_addfinalizerMethod · 0.95

Tested by

no test coverage detected