test_requests.py 文件源码

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

项目:packaging 作者: blockstack 项目源码 文件源码
def test_requests_cm(self):
        """
        Tests whether requests can be used importing standard_library modules
        previously with the hooks context manager
        """
        code = """
            from future import standard_library
            with standard_library.hooks():
                import builtins
                import html.parser
                import http.client
            """
        with write_module(code, self.tempdir):
            import test_imports_future_stdlib
            try:
                import requests
            except ImportError:
                print("Requests doesn't seem to be available. Skipping requests test ...")
            else:
                r = requests.get('http://google.com')
                self.assertTrue(r)
            self.assertTrue(True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号