def test_select_module_defines_does_not_implement_poll(self):
# This test is to make sure that if a platform defines
# a selector as being available but does not actually
# implement it.
# Reset the _DEFAULT_SELECTOR value as if using for the first time.
selectors2._DEFAULT_SELECTOR = None
# Now we're going to patch in a bad `poll`.
class BadPoll(object):
def poll(self, timeout):
raise OSError(errno.ENOSYS)
# Remove all selectors except `select.select` and replace `select.poll`.
patch_select_module(self, 'select', poll=BadPoll)
selector = self.make_selector()
self.assertIsInstance(selector, selectors2.SelectSelector)
评论列表
文章目录