From 9c027d4f672a29a69099807f910514ccc638d653 Mon Sep 17 00:00:00 2001 From: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Fri, 26 Jun 2026 12:24:20 +0300 Subject: [PATCH] Update `test/signalinterproctester.py` to 3.14.6 (#8173) * Update `test/signalinterproctester.py` to 3.14.6 * Add `signalinterproctester.py` as a test dependency of `test_signal.py` --- Lib/test/signalinterproctester.py | 22 +++++++++++++++------- scripts/update_lib/deps.py | 6 ++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Lib/test/signalinterproctester.py b/Lib/test/signalinterproctester.py index 168b5da0f..073c078f4 100644 --- a/Lib/test/signalinterproctester.py +++ b/Lib/test/signalinterproctester.py @@ -1,9 +1,11 @@ +import gc import os import signal import subprocess import sys import time import unittest +from test import support class SIGUSR1Exception(Exception): @@ -27,16 +29,15 @@ class InterProcessSignalTests(unittest.TestCase): # (if set) child.wait() - timeout = 10.0 - deadline = time.monotonic() + timeout - - while time.monotonic() < deadline: + start_time = time.monotonic() + for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False): if self.got_signals[signame]: return signal.pause() - - self.fail('signal %s not received after %s seconds' - % (signame, timeout)) + else: + dt = time.monotonic() - start_time + self.fail('signal %s not received after %.1f seconds' + % (signame, dt)) def subprocess_send_signal(self, pid, signame): code = 'import os, signal; os.kill(%s, signal.%s)' % (pid, signame) @@ -59,6 +60,13 @@ class InterProcessSignalTests(unittest.TestCase): self.assertEqual(self.got_signals, {'SIGHUP': 1, 'SIGUSR1': 0, 'SIGALRM': 0}) + # gh-110033: Make sure that the subprocess.Popen is deleted before + # the next test which raises an exception. Otherwise, the exception + # may be raised when Popen.__del__() is executed and so be logged + # as "Exception ignored in: ". + child = None + gc.collect() + with self.assertRaises(SIGUSR1Exception): with self.subprocess_send_signal(pid, "SIGUSR1") as child: self.wait_signal(child, 'SIGUSR1') diff --git a/scripts/update_lib/deps.py b/scripts/update_lib/deps.py index 72374aa6b..da49490c7 100644 --- a/scripts/update_lib/deps.py +++ b/scripts/update_lib/deps.py @@ -724,6 +724,12 @@ DEPENDENCIES = { "curses_tests.py", ], }, + "signal": { + "test": [ + "signalinterproctester.py", + "test_signal.py", + ] + }, }