(config: Config)
| 154 | |
| 155 | |
| 156 | def pytest_unconfigure(config: Config) -> None: |
| 157 | class="cm"># Runs before ``_cleanup_stack.close()``, so warning filters from |
| 158 | class="cm"># cleanup-stack-managed contexts (notably the ``warnings`` plugin's |
| 159 | class="cm"># ``catch_warnings``) are still installed when garbage-collected |
| 160 | class="cm"># finalizers fire. A ``config.add_cleanup`` callback would instead |
| 161 | class="cm"># couple correctness to LIFO pop order across plugins' cleanups. |
| 162 | if unraisable_exceptions not in config.stash: |
| 163 | class="cm"># ``pytest_configure`` did not complete (e.g. a usage error raised |
| 164 | class="cm"># in another plugin's configure), so the queue stash was never set. |
| 165 | return |
| 166 | class="cm"># PyPy can resurrect objects in __del__, so it needs several GC passes |
| 167 | class="cm"># (5, per the Trio project); CPython frees cycles in one pass. See #14441. |
| 168 | _default_gc_collect_iterations = 5 if sys.implementation.name == class="st">"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