Closed ruaridhw closed 4 years ago
It looks like the hard dependence on the mock
library might be causing problems (I rarely use mock
, and in our other discussion missed that mock was a separate package before Python 3.3). I am not sure how others will feel about adding another dependency. At a minimum, we should promulgate the mock
from unittest
in Python3:
if six.PY3:
from unittest import mock
else:
import mock
I wonder if it also makes sense to make the dependency optional:
if six.PY3:
from unittest import mock
mock_available = True
else:
try:
import mock
mock_available = True
except ImportError:
mock_available = False
Thoughts?
Updated accordingly though I figured that using Python3 doesn't necessarily imply that mock
exists in unittest
since it wasn't around in 3.0
@ruaridhw: correct, but PyUtilib explicitly doesn't support 3.0-3.3, so we can be lazy.
Fixes:
Summary/Motivation:
unittest.mock
in packages that import pyutilib.th as unittestChanges proposed in this PR:
-
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: