From 857daa808132a5fd0ef4ea60397c1b53073c3703 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Tue, 4 Feb 2025 12:16:47 +0100 Subject: [PATCH] disable gc within the subprocess --- testing/test_unraisableexception.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/testing/test_unraisableexception.py b/testing/test_unraisableexception.py index 3f191073e2b..328177a7ba3 100644 --- a/testing/test_unraisableexception.py +++ b/testing/test_unraisableexception.py @@ -321,6 +321,9 @@ def test_refcycle_unraisable_warning_filter_default(pytester: Pytester) -> None: # see: https://github.com/pytest-dev/pytest/pull/13057#discussion_r1888396126 pytester.makepyfile( test_it=""" + import gc + gc.disable() + import pytest class BrokenDel: @@ -335,8 +338,8 @@ def test_it(): """ ) - with _disable_gc(): - result = pytester.runpytest_subprocess("-Wdefault") + # since we use subprocess we need to disable gc inside test_it + result = pytester.runpytest_subprocess("-Wdefault") assert result.ret == pytest.ExitCode.OK