summaryrefslogtreecommitdiff
path: root/taskflow/test.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-10-14 15:59:54 -0700
committerJoshua Harlow <harlowja@gmail.com>2014-10-18 20:26:00 -0700
commitca101d1abeddc4dc34c54c3b3e182bf008bb86c2 (patch)
tree37c155bf483ed129989d2913d63c7cf3adad9c61 /taskflow/test.py
parentc95a681a9fdee40eefb098b52e98548092a6dbe4 (diff)
downloadtaskflow-ca101d1abeddc4dc34c54c3b3e182bf008bb86c2.tar.gz
Use the mock that finds a working implementation
Instead of using the library provided mock, use the import logic in our tests module that tries to find the best one that is usable in the current environment. It appears that this logic is *still* needed due to bugs in the non-bundled mock that causes errors/exceptions such as: AttributeError: 'method-wrapper' object has no attribute '__module__' It seems this is related to (or is this same) upstream bug: - https://code.google.com/p/mock/issues/detail?id=234 Change-Id: Ifeb3017f43b7d34af155ceca35d040706d34b185
Diffstat (limited to 'taskflow/test.py')
-rw-r--r--taskflow/test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/taskflow/test.py b/taskflow/test.py
index 32c0b0f..c6a56a9 100644
--- a/taskflow/test.py
+++ b/taskflow/test.py
@@ -21,13 +21,20 @@ import fixtures
from oslotest import base
from oslotest import mockpatch
import six
+
+# This is weird like this since we want to import a mock that works the best
+# and we need to try this import order, since oslotest registers a six.moves
+# module (but depending on the import order of importing oslotest we may or
+# may not see that change when trying to use it from six).
try:
from six.moves import mock
except ImportError:
try:
+ # In python 3.3+ mock got included in the standard library...
from unittest import mock
except ImportError:
import mock
+
from testtools import compat
from testtools import matchers
from testtools import testcase