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

Function pytest_unconfigure

src/_pytest/unraisableexception.py:156–173  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

154
155
156def pytest_unconfigure(config: Config) -> None:
157 # Runs before ``_cleanup_stack.close()``, so warning filters from
158 # cleanup-stack-managed contexts (notably the ``warnings`` plugin's
159 # ``catch_warnings``) are still installed when garbage-collected
160 # finalizers fire. A ``config.add_cleanup`` callback would instead
161 # couple correctness to LIFO pop order across plugins' cleanups.
162 if unraisable_exceptions not in config.stash:
163 # ``pytest_configure`` did not complete (e.g. a usage error raised
164 # in another plugin's configure), so the queue stash was never set.
165 return
166 # PyPy can resurrect objects in __del__, so it needs several GC passes
167 # (5, per the Trio project); CPython frees cycles in one pass. See #14441.
168 _default_gc_collect_iterations = 5 if sys.implementation.name == "pypy" else 1
169 gc_collect_iterations = config.stash.get(
170 gc_collect_iterations_key, _default_gc_collect_iterations
171 )
172 gc_collect_harder(gc_collect_iterations)
173 collect_unraisable(config)
174
175
176@pytest.hookimpl(trylast=True)

Callers

nothing calls this directly

Calls 3

gc_collect_harderFunction · 0.85
collect_unraisableFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…