diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-04-04 04:51:19 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-04-04 04:51:19 (GMT) |
commit | 2b860db35c5346c216672f94031ecc800dbebf02 (patch) | |
tree | ca61783cde41feaeffa8c217ebafc93aa891f1db /Lib | |
parent | ba43774d1c496d66c43b1dc3b2aab88c4a7aa64a (diff) | |
download | cpython-2b860db35c5346c216672f94031ecc800dbebf02.zip cpython-2b860db35c5346c216672f94031ecc800dbebf02.tar.gz cpython-2b860db35c5346c216672f94031ecc800dbebf02.tar.bz2 |
Doh! os.read() raises an OSError, not an IOError when it's interrupted.
And fix some flakiness in test_itimer_prof, which could detect that the timer
had reached 0 before the signal arrived announcing that fact.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_signal.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index acb8e57..dea518a 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -31,7 +31,7 @@ def exit_subprocess(): def ignoring_eintr(__func, *args, **kwargs): try: return __func(*args, **kwargs) - except IOError as e: + except EnvironmentError as e: if e.errno != signal.EINTR: raise return None @@ -363,12 +363,15 @@ class ItimerTest(unittest.TestCase): def test_itimer_prof(self): self.itimer = signal.ITIMER_PROF signal.signal(signal.SIGPROF, self.sig_prof) - signal.setitimer(self.itimer, 0.2) + signal.setitimer(self.itimer, 0.2, 0.2) for i in xrange(100000000): if signal.getitimer(self.itimer) == (0.0, 0.0): break # sig_prof handler stopped this itimer + # profiling itimer should be (0.0, 0.0) now + self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) + # and the handler should have been called self.assertEqual(self.hndl_called, True) def test_main(): |