diff options
| author | Russell Davis <551404+russelldavis@users.noreply.github.com> | 2020-04-15 11:57:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-15 11:57:06 -0700 |
| commit | ba1bcffe5cafc1bb0ac6fdf9ecef51e75e342707 (patch) | |
| tree | 59682606714c5402a5bb72f8926a4d5f7b69323d /Lib/test/test_selectors.py | |
| parent | 4b4e90a51848578dc06341777a929a0be4f4757f (diff) | |
| download | cpython-git-ba1bcffe5cafc1bb0ac6fdf9ecef51e75e342707.tar.gz | |
bpo-29255: Wait in KqueueSelector.select when no fds are registered (GH-19508)
Also partially fixes bpo-25680 (there's still a discrepancy in behavior
on Windows that needs to be fixed).
Diffstat (limited to 'Lib/test/test_selectors.py')
| -rw-r--r-- | Lib/test/test_selectors.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py index 31611224dc..c449155c4b 100644 --- a/Lib/test/test_selectors.py +++ b/Lib/test/test_selectors.py @@ -543,6 +543,19 @@ class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn): with self.assertRaises(KeyError): s.get_key(bad_f) + def test_empty_select_timeout(self): + # Issues #23009, #29255: Make sure timeout is applied when no fds + # are registered. + s = self.SELECTOR() + self.addCleanup(s.close) + + t0 = time() + self.assertEqual(s.select(1), []) + t1 = time() + dt = t1 - t0 + # Tolerate 2.0 seconds for very slow buildbots + self.assertTrue(0.8 <= dt <= 2.0, dt) + @unittest.skipUnless(hasattr(selectors, 'DevpollSelector'), "Test needs selectors.DevpollSelector") |
