test_iostream.py 文件源码

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

项目:microProxy 作者: mike820324 项目源码 文件源码
def test_inline_read_error(self):
        # An error on an inline read is raised without logging (on the
        # assumption that it will eventually be noticed or logged further
        # up the stack).
        #
        # This test is posix-only because windows os.close() doesn't work
        # on socket FDs, but we can't close the socket object normally
        # because we won't get the error we want if the socket knows
        # it's closed.
        server, client = self.make_iostream_pair()
        try:
            os.close(server.socket.fileno())
            if isinstance(server, MicroProxySSLIOStream):
                with self.assertRaises(SSL.SysCallError):
                    server.read_bytes(1, lambda data: None)

            if isinstance(server, MicroProxyIOStream):
                with self.assertRaises(socket.error):
                    server.read_bytes(1, lambda data: None)
        finally:
            server.close()
            client.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号