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: I1cffb9710f9e6b9b8b1f5e658d5af8668f3fca4c
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-04-18 11:57:19 -05:00
parent 0f90d197e1
commit e164881bd5
22 changed files with 36 additions and 27 deletions

View File

@ -18,9 +18,10 @@ HTTP requests may be made as normal but they will not actually traverse
a real socket.
"""
from unittest import mock
from keystoneauth1 import adapter
from keystoneauth1 import session
import mock
from oslo_utils import uuidutils
import requests
from wsgi_intercept import interceptor

View File

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import os_resource_classes as orc
from oslo_utils.fixture import uuidsentinel

View File

@ -11,7 +11,7 @@
# under the License.
import datetime
import mock
from unittest import mock
from oslo_utils import timeutils

View File

@ -24,8 +24,9 @@ the tests.
"""
from unittest import mock
from alembic import script
import mock
from oslo_db.sqlalchemy import test_fixtures
from oslo_db.sqlalchemy import test_migrations
from oslo_db.sqlalchemy import utils as db_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
import os_resource_classes as orc
from oslo_utils.fixture import uuidsentinel

View File

@ -11,7 +11,8 @@
# under the License.
import mock
from unittest import mock
import os_resource_classes as orc
from oslo_db import exception as db_exc
from oslo_utils.fixture import uuidsentinel

View File

@ -11,7 +11,8 @@
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslotest import output

View File

@ -11,7 +11,8 @@
# under the License.
"""Unit tests for code in the aggregate handler that gabbi isn't covering."""
import mock
from unittest import mock
import six
import webob

View File

@ -12,8 +12,9 @@
"""Unit tests for code in the trait handler that gabbi cannot easily cover."""
from unittest import mock
import microversion_parse
import mock
import webob
from placement import context

View File

@ -11,7 +11,8 @@
# under the License.
import mock
from unittest import mock
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils
import six

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 placement import lib as placement_lib
from placement.objects import allocation_candidate as ac_obj

View File

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import os_resource_classes as orc
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import timeutils

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 placement.objects import trait
from placement.tests.unit.objects import base

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 placement import context
from placement import exception

View File

@ -11,11 +11,11 @@
# under the License.
import mock
import testtools
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as config_fixture
import testtools
from placement import conf
from placement import db_api

View File

@ -12,7 +12,7 @@
# limitations under the License.
"""Tests for the placement fault wrap middleware."""
import mock
from unittest import mock
from oslo_serialization import jsonutils
import testtools

View File

@ -13,8 +13,9 @@
# under the License.
"""Unit tests for the functions used by the placement API handlers."""
from unittest import mock
import microversion_parse
import mock
from oslo_utils.fixture import uuidsentinel
import routes
import testtools

View File

@ -14,11 +14,11 @@
import collections
import operator
import testtools
import webob
from unittest import mock
import microversion_parse
import mock
import testtools
import webob
from placement import microversion

View File

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

View File

@ -12,7 +12,8 @@
# limitations under the License.
"""Tests for the placement request log middleware."""
import mock
from unittest import mock
import testtools
import webob

View File

@ -14,18 +14,17 @@
import datetime
from unittest import mock
import fixtures
import microversion_parse
import mock
from oslo_middleware import request_id
from oslo_utils.fixture import uuidsentinel
from oslo_utils import timeutils
import six
import testtools
import webob
import six
from placement import context
from placement import lib as pl
from placement import microversion

View File

@ -5,7 +5,6 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
# NOTE(tetsuro): Local testing on osx may have problems to install packages,
# psycopg2 and PYMySQL. You can workaround them using sys_platform qualifier.
# See the https://review.opendev.org/#/c/671249/ for details. However, we