summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-10-31 10:38:43 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-10-31 10:38:43 (GMT)
commita14c2ed15d493ee90585cc96a592bd1f3e702c9b (patch)
tree00beccae2d37f6c5262384237febf3ece680bc45 /Lib
parenta25b1312c91810ace91c6d6d9b86e93ffbcd06a7 (diff)
downloadcpython-a14c2ed15d493ee90585cc96a592bd1f3e702c9b.zip
cpython-a14c2ed15d493ee90585cc96a592bd1f3e702c9b.tar.gz
cpython-a14c2ed15d493ee90585cc96a592bd1f3e702c9b.tar.bz2
Merged revisions 75986 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r75986 | mark.dickinson | 2009-10-31 10:36:06 +0000 (Sat, 31 Oct 2009) | 2 lines Issue #7042: Use a better mechanism for testing timers in test_signal. ........
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))