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)
评论列表
文章目录