From e835f779337923b148f7f375a3af84bc37aa1094 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Sat, 25 Nov 2023 09:33:21 +0900 Subject: [PATCH] Address PyPy flakiness in test_for_leaking_fds --- src/trio/_tests/test_subprocess.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/trio/_tests/test_subprocess.py b/src/trio/_tests/test_subprocess.py index 93f3d3ac53..27642f1775 100644 --- a/src/trio/_tests/test_subprocess.py +++ b/src/trio/_tests/test_subprocess.py @@ -1,5 +1,6 @@ from __future__ import annotations +import gc import os import random import signal @@ -620,6 +621,8 @@ async def test_run_process_background_fail() -> None: reason="requires a way to iterate through open files", ) async def test_for_leaking_fds() -> None: + gc.collect() # address possible flakiness on PyPy + starting_fds = set(SyncPath("/dev/fd").iterdir()) await run_process(EXIT_TRUE) assert set(SyncPath("/dev/fd").iterdir()) == starting_fds