Open
Description
If I have the following...
module1.py:
from future import standard_library
standard_library.install_aliases()
with standard_library.suspend_hooks():
import module2
and module2.py:
from __future__ import print_function
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
print("Python2-style import")
else:
print("Python3-style import")
If I run $ python module1.py
I was expecting to see 'Python2-style import', but instead I'm getting 'Python3-style import'.
Is there something I'm misunderstanding about the suspend_hooks()
context manager? From the documentation, I assumed it would disable the Python3-style standard library imports so that imported libraries that break under monkeypatching will get the normal, Python2 libraries.