Browse Source

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>
changes/21/720921/2
Sean McGinnis 2 years ago
parent
commit
a9f7f67de5
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
  1. 2
      ironic_inspector/test/base.py
  2. 2
      ironic_inspector/test/functional.py
  3. 2
      ironic_inspector/test/unit/test_api_tools.py
  4. 2
      ironic_inspector/test/unit/test_common_ironic.py
  5. 3
      ironic_inspector/test/unit/test_coordination.py
  6. 2
      ironic_inspector/test/unit/test_db.py
  7. 2
      ironic_inspector/test/unit/test_dnsmasq_pxe_filter.py
  8. 2
      ironic_inspector/test/unit/test_introspect.py
  9. 3
      ironic_inspector/test/unit/test_iptables.py
  10. 3
      ironic_inspector/test/unit/test_keystone.py
  11. 3
      ironic_inspector/test/unit/test_locking.py
  12. 2
      ironic_inspector/test/unit/test_main.py
  13. 2
      ironic_inspector/test/unit/test_manager.py
  14. 2
      ironic_inspector/test/unit/test_migrations.py
  15. 2
      ironic_inspector/test/unit/test_node_cache.py
  16. 2
      ironic_inspector/test/unit/test_plugins_base.py
  17. 3
      ironic_inspector/test/unit/test_plugins_capabilities.py
  18. 2
      ironic_inspector/test/unit/test_plugins_discovery.py
  19. 2
      ironic_inspector/test/unit/test_plugins_extra_hardware.py
  20. 2
      ironic_inspector/test/unit/test_plugins_introspection_data.py
  21. 2
      ironic_inspector/test/unit/test_plugins_lldp_basic.py
  22. 3
      ironic_inspector/test/unit/test_plugins_local_link_connection.py
  23. 2
      ironic_inspector/test/unit/test_plugins_pci_devices.py
  24. 2
      ironic_inspector/test/unit/test_plugins_raid_device.py
  25. 3
      ironic_inspector/test/unit/test_plugins_rules.py
  26. 3
      ironic_inspector/test/unit/test_plugins_standard.py
  27. 2
      ironic_inspector/test/unit/test_process.py
  28. 3
      ironic_inspector/test/unit/test_pxe_filter.py
  29. 3
      ironic_inspector/test/unit/test_rules.py
  30. 3
      ironic_inspector/test/unit/test_swift.py
  31. 3
      ironic_inspector/test/unit/test_utils.py
  32. 1
      test-requirements.txt

2
ironic_inspector/test/base.py

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

2
ironic_inspector/test/functional.py

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

2
ironic_inspector/test/unit/test_api_tools.py

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

2
ironic_inspector/test/unit/test_common_ironic.py

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

3
ironic_inspector/test/unit/test_coordination.py

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

2
ironic_inspector/test/unit/test_db.py

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

2
ironic_inspector/test/unit/test_dnsmasq_pxe_filter.py

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

2
ironic_inspector/test/unit/test_introspect.py

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

3
ironic_inspector/test/unit/test_iptables.py

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

3
ironic_inspector/test/unit/test_keystone.py

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

3
ironic_inspector/test/unit/test_locking.py

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

2
ironic_inspector/test/unit/test_main.py

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

2
ironic_inspector/test/unit/test_manager.py

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

2
ironic_inspector/test/unit/test_migrations.py

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

2
ironic_inspector/test/unit/test_node_cache.py

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

2
ironic_inspector/test/unit/test_plugins_base.py

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

3
ironic_inspector/test/unit/test_plugins_capabilities.py

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

2
ironic_inspector/test/unit/test_plugins_discovery.py

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

2
ironic_inspector/test/unit/test_plugins_extra_hardware.py

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

2
ironic_inspector/test/unit/test_plugins_introspection_data.py

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

2
ironic_inspector/test/unit/test_plugins_lldp_basic.py

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

3
ironic_inspector/test/unit/test_plugins_local_link_connection.py

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

2
ironic_inspector/test/unit/test_plugins_pci_devices.py

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

2
ironic_inspector/test/unit/test_plugins_raid_device.py

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

3
ironic_inspector/test/unit/test_plugins_rules.py

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

3
ironic_inspector/test/unit/test_plugins_standard.py

@ -11,7 +11,8 @@
# See the 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

2
ironic_inspector/test/unit/test_process.py

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

3
ironic_inspector/test/unit/test_pxe_filter.py

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

3
ironic_inspector/test/unit/test_rules.py

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

3
ironic_inspector/test/unit/test_swift.py

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

3
ironic_inspector/test/unit/test_utils.py

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

1
test-requirements.txt

@ -7,7 +7,6 @@ coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
flake8-import-order>=0.13 # LGPLv3
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
sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
openstackdocstheme>=1.20.0 # Apache-2.0

Loading…
Cancel
Save