|
6 | 6 | import sys |
7 | 7 | from unittest import mock |
8 | 8 |
|
| 9 | +from _pytest import unraisableexception |
9 | 10 | from _pytest.pytester import Pytester |
10 | 11 | import pytest |
11 | 12 |
|
@@ -238,7 +239,10 @@ def _disable_gc() -> Generator[None]: |
238 | 239 | _set_gc_state(enabled=was_enabled) |
239 | 240 |
|
240 | 241 |
|
241 | | -def test_refcycle_unraisable(pytester: Pytester) -> None: |
| 242 | +def test_refcycle_unraisable( |
| 243 | + pytester: Pytester, monkeypatch: pytest.MonkeyPatch |
| 244 | +) -> None: |
| 245 | + monkeypatch.setattr(unraisableexception, "GC_COLLECT_ITERATIONS", 5) |
242 | 246 | # see: https://github.com/pytest-dev/pytest/issues/10404 |
243 | 247 | pytester.makepyfile( |
244 | 248 | test_it=""" |
@@ -267,7 +271,10 @@ def test_it(): |
267 | 271 |
|
268 | 272 |
|
269 | 273 | @pytest.mark.filterwarnings("default::pytest.PytestUnraisableExceptionWarning") |
270 | | -def test_refcycle_unraisable_warning_filter(pytester: Pytester) -> None: |
| 274 | +def test_refcycle_unraisable_warning_filter( |
| 275 | + pytester: Pytester, monkeypatch: pytest.MonkeyPatch |
| 276 | +) -> None: |
| 277 | + monkeypatch.setattr(unraisableexception, "GC_COLLECT_ITERATIONS", 5) |
271 | 278 | # note that the host pytest warning filter is disabled and the pytester |
272 | 279 | # warning filter applies during config teardown of unraisablehook. |
273 | 280 | # see: https://github.com/pytest-dev/pytest/issues/10404 |
@@ -298,7 +305,10 @@ def test_it(): |
298 | 305 |
|
299 | 306 |
|
300 | 307 | @pytest.mark.filterwarnings("default::pytest.PytestUnraisableExceptionWarning") |
301 | | -def test_create_task_raises_unraisable_warning_filter(pytester: Pytester) -> None: |
| 308 | +def test_create_task_raises_unraisable_warning_filter( |
| 309 | + pytester: Pytester, monkeypatch: pytest.MonkeyPatch |
| 310 | +) -> None: |
| 311 | + monkeypatch.setattr(unraisableexception, "GC_COLLECT_ITERATIONS", 5) |
302 | 312 | # note that the host pytest warning filter is disabled and the pytester |
303 | 313 | # warning filter applies during config teardown of unraisablehook. |
304 | 314 | # see: https://github.com/pytest-dev/pytest/issues/10404 |
|
0 commit comments