test_selectors2.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:selectors2 作者: SethMichaelLarson 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号