test_bypass.py 文件源码

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

项目:deb-python-httpretty 作者: openstack 项目源码 文件源码
def start_http_server(context):
    httpretty.disable()
    context.http_port = get_free_tcp_port()
    context.server = TornadoServer(context.http_port)
    context.server.start()
    ready = False
    timeout = 2
    started_at = time.time()
    while not ready:
        httpretty.disable()
        time.sleep(.1)
        try:
            requests.get('http://localhost:{0}/'.format(context.http_port))
            ready = True
        except:
            if time.time() - started_at >= timeout:
                break

    httpretty.enable()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号