summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-02-25 10:13:52 +0000
committerStephen Finucane <stephenfin@redhat.com>2021-02-25 10:13:52 +0000
commitf8df2192bf1190ff21a3067bb9e132b6db85191e (patch)
treeee54c0f469e9c8c0e9ae0a13ae1e598dc86a4b96
parent20bf99299955dd7152538fd23ea3b6fd95a87f65 (diff)
downloadfixtures-git-f8df2192bf1190ff21a3067bb9e132b6db85191e.tar.gz
Remove use of 'extras'
We weren't explicitly stating this dependency, instead relying on it being brought in by testtools. Since we want to remove it from testtools, we should drop it from here also. There's only one use of the 'try_imports' helper and a simple try-except does almost the same thing. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
-rw-r--r--fixtures/_fixtures/mockpatch.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/fixtures/_fixtures/mockpatch.py b/fixtures/_fixtures/mockpatch.py
index 8279a0f..6fa63bd 100644
--- a/fixtures/_fixtures/mockpatch.py
+++ b/fixtures/_fixtures/mockpatch.py
@@ -15,13 +15,15 @@
# License for the specific language governing permissions and limitations
# under the License.
-import extras
-
import fixtures
-mock = extras.try_imports(['mock', 'unittest.mock'], None)
-mock_default = extras.try_imports(
- ['mock.DEFAULT', 'unittest.mock.DEFAULT'], None)
+# TODO(stephenfin): Make this configurable
+try:
+ import mock
+except ImportError:
+ import unittest.mock as mock
+
+mock_default = mock.DEFAULT
class _Base(fixtures.Fixture):