From a54a8923ea4802ea0701753424ebc108c3ee6756 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Sat, 20 Jun 2026 02:54:56 +0500 Subject: [PATCH] Close PopenSpawn stdin and stdout explicitly. --- tests/test_command_shell.py | 2 ++ tests/test_crawler_subprocess.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tests/test_command_shell.py b/tests/test_command_shell.py index 1585835cc..5dcf2f519 100644 --- a/tests/test_command_shell.py +++ b/tests/test_command_shell.py @@ -159,5 +159,7 @@ class TestInteractiveShell: p.expect_exact("HtmlResponse") p.sendeof() p.wait() # type: ignore[no-untyped-call] + p.proc.stdin.close() + p.proc.stdout.close() logfile.seek(0) assert "Traceback" not in logfile.read().decode() diff --git a/tests/test_crawler_subprocess.py b/tests/test_crawler_subprocess.py index 146d94ecd..caedb7700 100644 --- a/tests/test_crawler_subprocess.py +++ b/tests/test_crawler_subprocess.py @@ -215,6 +215,8 @@ class TestCrawlerProcessSubprocessBase(ScriptRunnerMixin): p.expect_exact("shutting down gracefully") p.expect_exact("Spider closed (shutdown)") p.wait() # type: ignore[no-untyped-call] + p.proc.stdin.close() + p.proc.stdout.close() def test_shutdown_graceful(self) -> None: self._test_shutdown_graceful() @@ -232,6 +234,8 @@ class TestCrawlerProcessSubprocessBase(ScriptRunnerMixin): p.kill(sig) p.expect_exact("forcing unclean shutdown") p.wait() # type: ignore[no-untyped-call] + p.proc.stdin.close() + p.proc.stdout.close() @coroutine_test async def test_shutdown_forced(self) -> None: