From 814b7f23e296abb86fa6664279605cc9fab01e59 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sat, 18 Apr 2020 11:52:47 -0500 Subject: Use unittest.mock instead of third party mock Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Change-Id: I3e92b23ab2a335b378f156c0456fb1d52706ed12 Signed-off-by: Sean McGinnis --- glance_store/tests/unit/test_backend.py | 2 +- glance_store/tests/unit/test_cinder_store.py | 3 ++- glance_store/tests/unit/test_connection_manager.py | 2 +- glance_store/tests/unit/test_filesystem_store.py | 2 +- glance_store/tests/unit/test_http_store.py | 2 +- glance_store/tests/unit/test_multistore_cinder.py | 3 ++- glance_store/tests/unit/test_multistore_filesystem.py | 2 +- glance_store/tests/unit/test_multistore_rbd.py | 3 ++- glance_store/tests/unit/test_multistore_s3.py | 2 +- glance_store/tests/unit/test_multistore_vmware.py | 2 +- glance_store/tests/unit/test_rbd_store.py | 3 ++- glance_store/tests/unit/test_s3_store.py | 2 +- glance_store/tests/unit/test_store_base.py | 2 +- glance_store/tests/unit/test_swift_store.py | 3 ++- glance_store/tests/unit/test_swift_store_multibackend.py | 3 ++- glance_store/tests/unit/test_vmware_store.py | 2 +- 16 files changed, 22 insertions(+), 16 deletions(-) (limited to 'glance_store') diff --git a/glance_store/tests/unit/test_backend.py b/glance_store/tests/unit/test_backend.py index b176efe..7a3d03e 100644 --- a/glance_store/tests/unit/test_backend.py +++ b/glance_store/tests/unit/test_backend.py @@ -15,7 +15,7 @@ """Tests the backend store API's""" -import mock +from unittest import mock from glance_store import backend from glance_store import exceptions diff --git a/glance_store/tests/unit/test_cinder_store.py b/glance_store/tests/unit/test_cinder_store.py index de999d5..896bcfe 100644 --- a/glance_store/tests/unit/test_cinder_store.py +++ b/glance_store/tests/unit/test_cinder_store.py @@ -16,8 +16,9 @@ import contextlib import errno import hashlib -import mock import os +from unittest import mock + import six import socket import tempfile diff --git a/glance_store/tests/unit/test_connection_manager.py b/glance_store/tests/unit/test_connection_manager.py index 4529019..20be2fd 100644 --- a/glance_store/tests/unit/test_connection_manager.py +++ b/glance_store/tests/unit/test_connection_manager.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from glance_store._drivers.swift import connection_manager from glance_store._drivers.swift import store as swift_store diff --git a/glance_store/tests/unit/test_filesystem_store.py b/glance_store/tests/unit/test_filesystem_store.py index ebc664c..6f2661e 100644 --- a/glance_store/tests/unit/test_filesystem_store.py +++ b/glance_store/tests/unit/test_filesystem_store.py @@ -18,9 +18,9 @@ import errno import hashlib import json -import mock import os import stat +from unittest import mock import uuid import fixtures diff --git a/glance_store/tests/unit/test_http_store.py b/glance_store/tests/unit/test_http_store.py index 7fb8b7c..4eafb88 100644 --- a/glance_store/tests/unit/test_http_store.py +++ b/glance_store/tests/unit/test_http_store.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import requests diff --git a/glance_store/tests/unit/test_multistore_cinder.py b/glance_store/tests/unit/test_multistore_cinder.py index 597c4bc..7f1f514 100644 --- a/glance_store/tests/unit/test_multistore_cinder.py +++ b/glance_store/tests/unit/test_multistore_cinder.py @@ -16,8 +16,9 @@ import contextlib import errno import hashlib -import mock import os +from unittest import mock + import six import socket import tempfile diff --git a/glance_store/tests/unit/test_multistore_filesystem.py b/glance_store/tests/unit/test_multistore_filesystem.py index e17109a..820d293 100644 --- a/glance_store/tests/unit/test_multistore_filesystem.py +++ b/glance_store/tests/unit/test_multistore_filesystem.py @@ -18,9 +18,9 @@ import errno import hashlib import json -import mock import os import stat +from unittest import mock import uuid import fixtures diff --git a/glance_store/tests/unit/test_multistore_rbd.py b/glance_store/tests/unit/test_multistore_rbd.py index 4d4d74b..353ad9e 100644 --- a/glance_store/tests/unit/test_multistore_rbd.py +++ b/glance_store/tests/unit/test_multistore_rbd.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_config import cfg from oslo_utils import units import six diff --git a/glance_store/tests/unit/test_multistore_s3.py b/glance_store/tests/unit/test_multistore_s3.py index 2850953..3c50a85 100644 --- a/glance_store/tests/unit/test_multistore_s3.py +++ b/glance_store/tests/unit/test_multistore_s3.py @@ -16,13 +16,13 @@ """Tests the Multiple S3 backend store""" import hashlib +from unittest import mock import uuid import boto3 import botocore from botocore import exceptions as boto_exceptions from botocore import stub -import mock from oslo_config import cfg from oslo_utils import units import six diff --git a/glance_store/tests/unit/test_multistore_vmware.py b/glance_store/tests/unit/test_multistore_vmware.py index 7ca8a7a..e060dd1 100644 --- a/glance_store/tests/unit/test_multistore_vmware.py +++ b/glance_store/tests/unit/test_multistore_vmware.py @@ -16,9 +16,9 @@ """Tests the Multiple VMware Datastore backend store""" import hashlib +from unittest import mock import uuid -import mock from oslo_config import cfg from oslo_utils import units from oslo_vmware import api diff --git a/glance_store/tests/unit/test_rbd_store.py b/glance_store/tests/unit/test_rbd_store.py index 5af6bac..8d30855 100644 --- a/glance_store/tests/unit/test_rbd_store.py +++ b/glance_store/tests/unit/test_rbd_store.py @@ -14,7 +14,8 @@ # under the License. import hashlib -import mock +from unittest import mock + from oslo_utils import units import six diff --git a/glance_store/tests/unit/test_s3_store.py b/glance_store/tests/unit/test_s3_store.py index 1cf7e46..a101e36 100644 --- a/glance_store/tests/unit/test_s3_store.py +++ b/glance_store/tests/unit/test_s3_store.py @@ -16,13 +16,13 @@ """Tests the S3 backend store""" import hashlib +from unittest import mock import uuid import boto3 import botocore from botocore import exceptions as boto_exceptions from botocore import stub -import mock from oslo_utils import units import six diff --git a/glance_store/tests/unit/test_store_base.py b/glance_store/tests/unit/test_store_base.py index 2f8e53f..ee3fc22 100644 --- a/glance_store/tests/unit/test_store_base.py +++ b/glance_store/tests/unit/test_store_base.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from oslo_config import cfg diff --git a/glance_store/tests/unit/test_swift_store.py b/glance_store/tests/unit/test_swift_store.py index 8d82053..3c1f8d7 100644 --- a/glance_store/tests/unit/test_swift_store.py +++ b/glance_store/tests/unit/test_swift_store.py @@ -16,9 +16,10 @@ """Tests the Swift backend store""" import copy +from unittest import mock + import fixtures import hashlib -import mock import tempfile import uuid diff --git a/glance_store/tests/unit/test_swift_store_multibackend.py b/glance_store/tests/unit/test_swift_store_multibackend.py index 83b8517..0c901d6 100644 --- a/glance_store/tests/unit/test_swift_store_multibackend.py +++ b/glance_store/tests/unit/test_swift_store_multibackend.py @@ -16,9 +16,10 @@ """Tests the Swift backend store""" import copy +from unittest import mock + import fixtures import hashlib -import mock import tempfile import uuid diff --git a/glance_store/tests/unit/test_vmware_store.py b/glance_store/tests/unit/test_vmware_store.py index 661a25c..935c08f 100644 --- a/glance_store/tests/unit/test_vmware_store.py +++ b/glance_store/tests/unit/test_vmware_store.py @@ -16,9 +16,9 @@ """Tests the VMware Datastore backend store""" import hashlib +from unittest import mock import uuid -import mock from oslo_utils import units from oslo_vmware import api from oslo_vmware import exceptions as vmware_exceptions -- cgit v1.2.1