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: Ic67f09a223ae2d0cb460771a10a4122307afa05b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-04-18 11:53:19 -05:00
parent 216de6692b
commit a9f7f67de5
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
32 changed files with 43 additions and 32 deletions

View File

@ -13,10 +13,10 @@
import datetime import datetime
import time import time
from unittest import mock
import fixtures import fixtures
import futurist import futurist
import mock
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from oslo_config import fixture as config_fixture from oslo_config import fixture as config_fixture
from oslo_log import log from oslo_log import log

View File

@ -21,11 +21,11 @@ import sys
import tempfile import tempfile
import time import time
import unittest import unittest
from unittest import mock
import urllib import urllib
import eventlet import eventlet
import fixtures import fixtures
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_config import fixture as config_fixture from oslo_config import fixture as config_fixture
from oslo_utils import timeutils from oslo_utils import timeutils

View File

@ -12,9 +12,9 @@
# limitations under the License. # limitations under the License.
import functools import functools
from unittest import mock
import flask import flask
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,8 +13,8 @@
import socket import socket
import unittest import unittest
from unittest import mock
import mock
import openstack import openstack
from openstack import exceptions as os_exc from openstack import exceptions as os_exc

View File

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

View File

@ -11,7 +11,7 @@
# under the License. # under the License.
import mock from unittest import mock
from ironic_inspector import db from ironic_inspector import db
from ironic_inspector.test import base as test_base from ironic_inspector.test import base as test_base

View File

@ -18,9 +18,9 @@ except ImportError:
import os.errno as errno import os.errno as errno
import datetime import datetime
import os import os
from unittest import mock
import fixtures import fixtures
import mock
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,9 +13,9 @@
import collections import collections
import time import time
from unittest import mock
import fixtures import fixtures
import mock
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import fixtures import fixtures
import mock
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_config import cfg from oslo_config import cfg

View File

@ -11,8 +11,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock
from keystoneauth1 import loading as kaloading from keystoneauth1 import loading as kaloading
import mock
from oslo_config import cfg from oslo_config import cfg
from ironic_inspector.common import keystone from ironic_inspector.common import keystone

View File

@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from ironic_inspector.common import coordination from ironic_inspector.common import coordination

View File

@ -14,9 +14,9 @@
import datetime import datetime
import json import json
import unittest import unittest
from unittest import mock
import fixtures import fixtures
import mock
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -12,10 +12,10 @@
# limitations under the License. # limitations under the License.
import json import json
from unittest import mock
import fixtures import fixtures
from ironic_lib import mdns from ironic_lib import mdns
import mock
import oslo_messaging as messaging import oslo_messaging as messaging
import tooz import tooz

View File

@ -25,10 +25,10 @@ The test will then use that db and u/p combo to run the tests.
import contextlib import contextlib
import datetime import datetime
from unittest import mock
import alembic import alembic
from alembic import script from alembic import script
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy.migration_cli import ext_alembic from oslo_db.sqlalchemy.migration_cli import ext_alembic

View File

@ -16,9 +16,9 @@ import datetime
import functools import functools
import json import json
import unittest import unittest
from unittest import mock
import automaton import automaton
import mock
from oslo_config import cfg from oslo_config import cfg
import oslo_db import oslo_db
from oslo_utils import timeutils from oslo_utils import timeutils

View File

@ -12,8 +12,8 @@
# limitations under the License. # limitations under the License.
import collections import collections
from unittest import mock
import mock
from ironic_inspector.plugins import base from ironic_inspector.plugins import base
from ironic_inspector.test import base as test_base from ironic_inspector.test import base as test_base

View File

@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from ironic_inspector import node_cache from ironic_inspector import node_cache

View File

@ -11,8 +11,8 @@
# under the License. # under the License.
import copy import copy
from unittest import mock
import mock
from ironic_inspector.common import ironic as ir_utils from ironic_inspector.common import ironic as ir_utils
from ironic_inspector import node_cache from ironic_inspector import node_cache

View File

@ -12,8 +12,8 @@
# limitations under the License. # limitations under the License.
import json import json
from unittest import mock
import mock
from ironic_inspector import node_cache from ironic_inspector import node_cache
from ironic_inspector.plugins import extra_hardware from ironic_inspector.plugins import extra_hardware

View File

@ -12,9 +12,9 @@
# limitations under the License. # limitations under the License.
import json import json
from unittest import mock
import fixtures import fixtures
import mock
from oslo_config import cfg from oslo_config import cfg
from ironic_inspector.common import ironic as ir_utils from ironic_inspector.common import ironic as ir_utils

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from ironic_inspector.common import lldp_parsers as nv from ironic_inspector.common import lldp_parsers as nv
from ironic_inspector.plugins import lldp_basic from ironic_inspector.plugins import lldp_basic

View File

@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from openstack import exceptions from openstack import exceptions
from oslo_config import cfg from oslo_config import cfg

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from ironic_inspector import node_cache from ironic_inspector import node_cache
from ironic_inspector.plugins import base from ironic_inspector.plugins import base

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from ironic_inspector import node_cache from ironic_inspector import node_cache
from ironic_inspector.plugins import base from ironic_inspector.plugins import base

View File

@ -14,7 +14,8 @@
"""Tests for introspection rules plugins.""" """Tests for introspection rules plugins."""
import mock from unittest import mock
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from ironic_inspector.common import ironic as ir_utils from ironic_inspector.common import ironic as ir_utils

View File

@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import units from oslo_utils import units

View File

@ -17,10 +17,10 @@ import json
import os import os
import shutil import shutil
import tempfile import tempfile
from unittest import mock
import eventlet import eventlet
import fixtures import fixtures
import mock
from openstack import exceptions as os_exc from openstack import exceptions as os_exc
from oslo_config import cfg from oslo_config import cfg
from oslo_serialization import base64 from oslo_serialization import base64

View File

@ -11,11 +11,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock
from automaton import exceptions as automaton_errors from automaton import exceptions as automaton_errors
from eventlet import semaphore from eventlet import semaphore
import fixtures import fixtures
from futurist import periodics from futurist import periodics
import mock
from oslo_config import cfg from oslo_config import cfg
import stevedore import stevedore

View File

@ -13,7 +13,8 @@
# under the License. # under the License.
"""Tests for introspection rules.""" """Tests for introspection rules."""
import mock from unittest import mock
from oslo_utils import uuidutils from oslo_utils import uuidutils
from ironic_inspector import db from ironic_inspector import db

View File

@ -14,8 +14,9 @@
# Mostly copied from ironic/tests/test_swift.py # Mostly copied from ironic/tests/test_swift.py
from unittest import mock
from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import exceptions as ks_exc
import mock
import openstack import openstack
from openstack import exceptions as os_exc from openstack import exceptions as os_exc

View File

@ -11,8 +11,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock
from keystonemiddleware import auth_token from keystonemiddleware import auth_token
import mock
from openstack.baremetal.v1 import node from openstack.baremetal.v1 import node
from oslo_config import cfg from oslo_config import cfg

View File

@ -7,7 +7,6 @@ coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0
flake8-import-order>=0.13 # LGPLv3 flake8-import-order>=0.13 # LGPLv3
hacking>=3.0.0,<3.1.0 # Apache-2.0 hacking>=3.0.0,<3.1.0 # Apache-2.0
mock>=3.0.0 # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
openstackdocstheme>=1.20.0 # Apache-2.0 openstackdocstheme>=1.20.0 # Apache-2.0