summaryrefslogtreecommitdiffstats
path: root/Lib/test/eintrdata
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-31 09:48:34 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-31 09:48:34 (GMT)
commit4448c08451e947ccf197742d22fa49adba71e363 (patch)
treef1183e1f289ad178ec22e274644b86a6c3a0cf55 /Lib/test/eintrdata
parentb6faf0dfa7e5d9f5b9f09bc1d1113069f1c962ab (diff)
downloadcpython-4448c08451e947ccf197742d22fa49adba71e363.zip
cpython-4448c08451e947ccf197742d22fa49adba71e363.tar.gz
cpython-4448c08451e947ccf197742d22fa49adba71e363.tar.bz2
Issue #23485: select.kqueue.control() is now retried when interrupted by a signal
Diffstat (limited to 'Lib/test/eintrdata')
-rw-r--r--Lib/test/eintrdata/eintr_tester.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
index 0df9762..4e9b992 100644
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/eintrdata/eintr_tester.py
@@ -315,8 +315,8 @@ class SelectEINTRTest(EINTRBaseTest):
def test_select(self):
t0 = time.monotonic()
select.select([], [], [], self.sleep_time)
- self.stop_alarm()
dt = time.monotonic() - t0
+ self.stop_alarm()
self.assertGreaterEqual(dt, self.sleep_time)
@unittest.skipUnless(hasattr(select, 'poll'), 'need select.poll')
@@ -325,8 +325,8 @@ class SelectEINTRTest(EINTRBaseTest):
t0 = time.monotonic()
poller.poll(self.sleep_time * 1e3)
- self.stop_alarm()
dt = time.monotonic() - t0
+ self.stop_alarm()
self.assertGreaterEqual(dt, self.sleep_time)
@unittest.skipUnless(hasattr(select, 'epoll'), 'need select.epoll')
@@ -336,8 +336,19 @@ class SelectEINTRTest(EINTRBaseTest):
t0 = time.monotonic()
poller.poll(self.sleep_time)
+ dt = time.monotonic() - t0
self.stop_alarm()
+ self.assertGreaterEqual(dt, self.sleep_time)
+
+ @unittest.skipUnless(hasattr(select, 'kqueue'), 'need select.kqueue')
+ def test_kqueue(self):
+ kqueue = select.kqueue()
+ self.addCleanup(kqueue.close)
+
+ t0 = time.monotonic()
+ kqueue.control(None, 1, self.sleep_time)
dt = time.monotonic() - t0
+ self.stop_alarm()
self.assertGreaterEqual(dt, self.sleep_time)