Skip to content

Commit

Permalink
Use unittest.mock instead of third party mock
Browse files Browse the repository at this point in the history
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 <sean.mcginnis@gmail.com>
  • Loading branch information
stmcginnis committed Apr 18, 2020
1 parent 2aa892d commit 814b7f2
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion glance_store/tests/unit/test_cinder_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
import contextlib
import errno
import hashlib
import mock
import os
from unittest import mock

import six
import socket
import tempfile
Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_connection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_filesystem_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import errno
import hashlib
import json
import mock
import os
import stat
from unittest import mock
import uuid

import fixtures
Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_http_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import mock
from unittest import mock

import requests

Expand Down
3 changes: 2 additions & 1 deletion glance_store/tests/unit/test_multistore_cinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
import contextlib
import errno
import hashlib
import mock
import os
from unittest import mock

import six
import socket
import tempfile
Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_multistore_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import errno
import hashlib
import json
import mock
import os
import stat
from unittest import mock
import uuid

import fixtures
Expand Down
3 changes: 2 additions & 1 deletion glance_store/tests/unit/test_multistore_rbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_multistore_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_multistore_vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion glance_store/tests/unit/test_rbd_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# under the License.

import hashlib
import mock
from unittest import mock

from oslo_utils import units
import six

Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_s3_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_store_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion glance_store/tests/unit/test_swift_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion glance_store/tests/unit/test_swift_store_multibackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion glance_store/tests/unit/test_vmware_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ hacking>=3.0,<3.1.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0

# Packaging
mock>=2.0.0 # BSD

# Unit testing
coverage!=4.4,>=4.0 # Apache-2.0
Expand Down

0 comments on commit 814b7f2

Please sign in to comment.