summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_signal.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 4e06a34..c00a77f 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -360,11 +360,14 @@ class ItimerTest(unittest.TestCase):
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
signal.setitimer(self.itimer, 0.3, 0.2)
- for i in range(100000000):
+ start_time = time.time()
+ while time.time() - start_time < 5.0:
# use up some virtual time by doing real work
_ = pow(12345, 67890, 10000019)
if signal.getitimer(self.itimer) == (0.0, 0.0):
break # sig_vtalrm handler stopped this itimer
+ else:
+ self.fail('timeout waiting for sig_vtalrm signal')
# virtual itimer should be (0.0, 0.0) now
self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))
@@ -376,9 +379,14 @@ class ItimerTest(unittest.TestCase):
signal.signal(signal.SIGPROF, self.sig_prof)
signal.setitimer(self.itimer, 0.2, 0.2)
- for i in range(100000000):
+ start_time = time.time()
+ while time.time() - start_time < 5.0:
+ # do some work
+ _ = pow(12345, 67890, 10000019)
if signal.getitimer(self.itimer) == (0.0, 0.0):
break # sig_prof handler stopped this itimer
+ else:
+ self.fail('timeout waiting for sig_prof signal')
# profiling itimer should be (0.0, 0.0) now
self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0))