@@ -698,7 +698,7 @@ def handler(signum, frame):
698
698
@unittest .skipUnless (hasattr (os , "pipe" ), "requires os.pipe()" )
699
699
class SiginterruptTest (unittest .TestCase ):
700
700
701
- def readpipe_interrupted (self , interrupt ):
701
+ def readpipe_interrupted (self , interrupt , timeout ):
702
702
"""Perform a read during which a signal will arrive. Return True if the
703
703
read is interrupted by the signal and raises an exception. Return False
704
704
if it returns normally.
@@ -746,7 +746,7 @@ def handler(signum, frame):
746
746
# wait until the child process is loaded and has started
747
747
first_line = process .stdout .readline ()
748
748
749
- stdout , stderr = process .communicate (timeout = support . SHORT_TIMEOUT )
749
+ stdout , stderr = process .communicate (timeout = timeout )
750
750
except subprocess .TimeoutExpired :
751
751
process .kill ()
752
752
return False
@@ -762,22 +762,22 @@ def test_without_siginterrupt(self):
762
762
# If a signal handler is installed and siginterrupt is not called
763
763
# at all, when that signal arrives, it interrupts a syscall that's in
764
764
# progress.
765
- interrupted = self .readpipe_interrupted (None )
765
+ interrupted = self .readpipe_interrupted (None , support . SHORT_TIMEOUT )
766
766
self .assertTrue (interrupted )
767
767
768
768
def test_siginterrupt_on (self ):
769
769
# If a signal handler is installed and siginterrupt is called with
770
770
# a true value for the second argument, when that signal arrives, it
771
771
# interrupts a syscall that's in progress.
772
- interrupted = self .readpipe_interrupted (True )
772
+ interrupted = self .readpipe_interrupted (True , support . SHORT_TIMEOUT )
773
773
self .assertTrue (interrupted )
774
774
775
775
@support .requires_resource ('walltime' )
776
776
def test_siginterrupt_off (self ):
777
777
# If a signal handler is installed and siginterrupt is called with
778
778
# a false value for the second argument, when that signal arrives, it
779
779
# does not interrupt a syscall that's in progress.
780
- interrupted = self .readpipe_interrupted (False )
780
+ interrupted = self .readpipe_interrupted (False , 2 )
781
781
self .assertFalse (interrupted )
782
782
783
783
0 commit comments