Closed
Description
try:
import mock as mock_module
except ImportError:
import unittest.mock as mock_module
Use this instead:
if sys.version_info.major == 2:
import mock as mock_module
else:
import unittest.mock as mock_module
This way we don't "swallow" the first exception in Python 2 in case something goes wrong when importing mock
.
EDIT: Just for the record, the first import mock as mock_module was raising an ImportError
but not because mock was missing, one of its dependencies was not installed (it was a frozen application). This made this problem much harder to debug.
cc @gqmelo
Metadata
Metadata
Assignees
Labels
No labels