(config: Config)
| 154 | |
| 155 | |
| 156 | def 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) |
nothing calls this directly
no test coverage detected
searching dependent graphs…