Skip to content

Commit f88aceb

Browse files
committed
gh-120039: Reduce expected timeout in test_siginterrupt_off
The process is expected to time out. In the refleak builds, `support.SHORT_TIMEOUT` is often five minutes and we run the tests six times, so test_signal was taking >30 minutes.
1 parent ff1857d commit f88aceb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_signal.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ def handler(signum, frame):
698698
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
699699
class SiginterruptTest(unittest.TestCase):
700700

701-
def readpipe_interrupted(self, interrupt):
701+
def readpipe_interrupted(self, interrupt, timeout):
702702
"""Perform a read during which a signal will arrive. Return True if the
703703
read is interrupted by the signal and raises an exception. Return False
704704
if it returns normally.
@@ -746,7 +746,7 @@ def handler(signum, frame):
746746
# wait until the child process is loaded and has started
747747
first_line = process.stdout.readline()
748748

749-
stdout, stderr = process.communicate(timeout=support.SHORT_TIMEOUT)
749+
stdout, stderr = process.communicate(timeout=timeout)
750750
except subprocess.TimeoutExpired:
751751
process.kill()
752752
return False
@@ -762,22 +762,22 @@ def test_without_siginterrupt(self):
762762
# If a signal handler is installed and siginterrupt is not called
763763
# at all, when that signal arrives, it interrupts a syscall that's in
764764
# progress.
765-
interrupted = self.readpipe_interrupted(None)
765+
interrupted = self.readpipe_interrupted(None, support.SHORT_TIMEOUT)
766766
self.assertTrue(interrupted)
767767

768768
def test_siginterrupt_on(self):
769769
# If a signal handler is installed and siginterrupt is called with
770770
# a true value for the second argument, when that signal arrives, it
771771
# interrupts a syscall that's in progress.
772-
interrupted = self.readpipe_interrupted(True)
772+
interrupted = self.readpipe_interrupted(True, support.SHORT_TIMEOUT)
773773
self.assertTrue(interrupted)
774774

775775
@support.requires_resource('walltime')
776776
def test_siginterrupt_off(self):
777777
# If a signal handler is installed and siginterrupt is called with
778778
# a false value for the second argument, when that signal arrives, it
779779
# does not interrupt a syscall that's in progress.
780-
interrupted = self.readpipe_interrupted(False)
780+
interrupted = self.readpipe_interrupted(False, 2)
781781
self.assertFalse(interrupted)
782782

783783

0 commit comments

Comments
 (0)