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: I44e7b6f76e2d12f620ec602afc77ce11ba6b9d9a
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-04-18 11:52:42 -05:00
parent 7af0b68b79
commit 94b0876429
43 changed files with 48 additions and 43 deletions

View File

@ -17,9 +17,9 @@
import copy
import datetime
from unittest import mock
import uuid
import mock
from oslo_db import exception as db_exception
from oslo_db.sqlalchemy import utils as sqlalchemyutils
# NOTE(jokke): simplified transition to py3, behaves like py2 xrange

View File

@ -16,8 +16,8 @@ import glance.common.config
import glance.common.wsgi
import glance.image_cache
from glance.tests import utils as test_utils
from unittest import mock
import mock
import webob

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
from unittest import mock
import glance_store as store
import mock
from oslo_config import cfg
from oslo_log import log as logging
import six

View File

@ -14,8 +14,8 @@
# under the License.
import json
import mock
import os
from unittest import mock
import glance_store
from oslo_concurrency import processutils

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import os
from unittest import mock
import glance_store
from oslo_config import cfg

View File

@ -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

View File

@ -14,8 +14,8 @@
# under the License.
import json
import mock
import os
from unittest import mock
import glance_store
from oslo_concurrency import processutils

View File

@ -14,7 +14,7 @@
# under the License.
import datetime
import mock
from unittest import mock
import glance_store as store_api
from oslo_config import cfg

View File

@ -14,8 +14,8 @@
# under the License.
import json
import mock
import os
from unittest import mock
import glance_store
from oslo_concurrency import processutils as putils

View File

@ -14,7 +14,7 @@
# under the License.
import json
import mock
from unittest import mock
import glance_store
from oslo_concurrency import processutils

View File

@ -17,8 +17,8 @@ import os.path
import shutil
import tarfile
import tempfile
from unittest import mock
import mock
try:
from defusedxml.cElementTree import ParseError
except ImportError:

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import os
from unittest import mock
from glance_store._drivers import filesystem
from glance_store import backend

View File

@ -14,7 +14,7 @@
# under the License.
import mock
from unittest import mock
import glance.async_
import glance.tests.utils as test_utils

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import glance_store
from oslo_config import cfg

View File

@ -14,10 +14,10 @@
# under the License.
import os
from unittest import mock
import glance_store as store
from glance_store import location
import mock
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_db import options

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from six.moves import urllib
import glance.common.exception as exception

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from six.moves import urllib
from glance.common import exception

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from six.moves import http_client
import testtools

View File

@ -14,7 +14,7 @@
# under the License.
import mock
from unittest import mock
import glance.common.scripts as scripts
from glance.common.scripts.image_import import main as image_import

View File

@ -15,9 +15,9 @@
import calendar
import datetime
from unittest import mock
import iso8601
import mock
from glance.common import timeutils
from glance.tests import utils as test_utils

View File

@ -15,8 +15,8 @@
# under the License.
import glance_store as store
import mock
import tempfile
from unittest import mock
from oslo_config import cfg
from oslo_log import log as logging

View File

@ -19,11 +19,11 @@ import datetime
import gettext
import os
import socket
from unittest import mock
from babel import localedata
import eventlet.patcher
import fixtures
import mock
from oslo_concurrency import processutils
from oslo_serialization import jsonutils
import routes

View File

@ -18,9 +18,9 @@ Tests for the sqlite image_cache driver.
"""
import os
from unittest import mock
import ddt
import mock
from glance.image_cache.drivers import sqlite
from glance.tests import utils

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from glance.db.sqlalchemy.alembic_migrations import data_migrations
from glance.tests import utils as test_utils

View File

@ -15,9 +15,9 @@
# under the License.
import datetime
from unittest import mock
import uuid
import mock
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_utils import encodeutils

View File

@ -15,9 +15,9 @@
# under the License.
import datetime
from unittest import mock
import uuid
import mock
from oslo_config import cfg
import oslo_utils.importutils

View File

@ -14,8 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
# NOTE(jokke): simplified transition to py3, behaves like py2 xrange
from unittest import mock
from six.moves import range
from glance.domain import proxy

View File

@ -14,7 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_db import exception as db_exception
from glance.cmd import manage

View File

@ -13,6 +13,7 @@
# under the License.
from __future__ import absolute_import
from unittest import mock
import copy
import os
@ -20,7 +21,6 @@ import sys
import uuid
import fixtures
import mock
from oslo_serialization import jsonutils
import six
from six import moves

View File

@ -14,9 +14,9 @@
# under the License.
from __future__ import absolute_import
from unittest import mock
import fixtures
import mock
from six.moves import StringIO
from glance.cmd import manage

View File

@ -15,9 +15,9 @@
# under the License.
import datetime
from unittest import mock
import glance_store
import mock
from oslo_config import cfg
import oslo_messaging
import webob

View File

@ -20,11 +20,11 @@ try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from unittest import mock
import hashlib
import os.path
import mock
import oslo_config.cfg
import glance.api.policy

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
from unittest import mock
import uuid
import mock
from mock import patch
from oslo_utils import encodeutils
from oslo_utils import units

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import glance_store
import mock
from mock import patch
from oslo_config import cfg
# NOTE(jokke): simplified transition to py3, behaves like py2 xrange

View File

@ -16,7 +16,7 @@ from cryptography import exceptions as crypto_exception
from cursive import exception as cursive_exception
from cursive import signature_utils
import glance_store
import mock
from unittest import mock
from glance.common import exception
import glance.location

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import glance_store
import mock
from unittest import mock
from glance.common import exception
from glance.common import store_utils

View File

@ -16,7 +16,8 @@
from cryptography import exceptions as crypto_exception
import glance_store as store
import mock
from unittest import mock
from oslo_config import cfg
from six.moves import urllib

View File

@ -12,12 +12,12 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
from cursive import exception as cursive_exception
import glance_store
from glance_store._drivers import filesystem
import mock
import six
from six.moves import http_client as http
import webob

View File

@ -17,11 +17,11 @@ import datetime
import eventlet
import hashlib
import os
from unittest import mock
import uuid
from castellan.common import exception as castellan_exception
import glance_store as store
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
import six

View File

@ -14,7 +14,7 @@
# under the License.
import datetime
import mock
from unittest import mock
from oslo_serialization import jsonutils
import webob

View File

@ -15,9 +15,9 @@
# under the License.
import datetime
from unittest import mock
import uuid
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from six.moves import http_client as http

View File

@ -24,10 +24,10 @@ import socket
import subprocess
import threading
import time
from unittest import mock
from alembic import command as alembic_command
import fixtures
import mock
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_log.fixture import logging_error as log_fixture

View File

@ -12,7 +12,6 @@ Babel!=2.4.0,>=2.3.4 # BSD
coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
requests>=2.14.2 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
testresources>=2.0.0 # Apache-2.0/BSD