diff --git a/magnum/tests/base.py b/magnum/tests/base.py index 92cae3790b..db6da9e537 100644 --- a/magnum/tests/base.py +++ b/magnum/tests/base.py @@ -15,9 +15,9 @@ import copy import os +from unittest import mock import fixtures -import mock from oslo_config import cfg from oslo_log import log import oslo_messaging diff --git a/magnum/tests/fakes.py b/magnum/tests/fakes.py index caadba6a2b..4407975306 100644 --- a/magnum/tests/fakes.py +++ b/magnum/tests/fakes.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import time +from unittest import mock from oslo_service import loopingcall diff --git a/magnum/tests/unit/api/base.py b/magnum/tests/unit/api/base.py index 4d02ba456d..a4dd3fef63 100644 --- a/magnum/tests/unit/api/base.py +++ b/magnum/tests/unit/api/base.py @@ -18,8 +18,9 @@ # https://bugs.launchpad.net/ironic/+bug/1255115. # NOTE(deva): import auth_token so we can override a config option +from unittest import mock + from keystonemiddleware import auth_token # noqa -import mock from oslo_config import cfg import pecan import pecan.testing diff --git a/magnum/tests/unit/api/controllers/test_base.py b/magnum/tests/unit/api/controllers/test_base.py index 9c565cb84d..b990ede0ca 100644 --- a/magnum/tests/unit/api/controllers/test_base.py +++ b/magnum/tests/unit/api/controllers/test_base.py @@ -10,7 +10,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + from webob import exc from magnum.api.controllers import base diff --git a/magnum/tests/unit/api/controllers/test_root.py b/magnum/tests/unit/api/controllers/test_root.py index 02ad31e45c..94a2fbb759 100644 --- a/magnum/tests/unit/api/controllers/test_root.py +++ b/magnum/tests/unit/api/controllers/test_root.py @@ -10,8 +10,9 @@ # See the 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 from webob import exc as webob_exc diff --git a/magnum/tests/unit/api/controllers/v1/test_bay.py b/magnum/tests/unit/api/controllers/v1/test_bay.py index 960a4066e6..5554e001bc 100644 --- a/magnum/tests/unit/api/controllers/v1/test_bay.py +++ b/magnum/tests/unit/api/controllers/v1/test_bay.py @@ -11,8 +11,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock from oslo_config import cfg from oslo_utils import timeutils from oslo_utils import uuidutils diff --git a/magnum/tests/unit/api/controllers/v1/test_baymodel.py b/magnum/tests/unit/api/controllers/v1/test_baymodel.py index eafedb4d60..b0f5ff86d1 100644 --- a/magnum/tests/unit/api/controllers/v1/test_baymodel.py +++ b/magnum/tests/unit/api/controllers/v1/test_baymodel.py @@ -11,8 +11,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock from oslo_utils import timeutils from oslo_utils import uuidutils from six.moves.urllib import parse as urlparse diff --git a/magnum/tests/unit/api/controllers/v1/test_certificate.py b/magnum/tests/unit/api/controllers/v1/test_certificate.py index e65af08a4f..fcf621782f 100644 --- a/magnum/tests/unit/api/controllers/v1/test_certificate.py +++ b/magnum/tests/unit/api/controllers/v1/test_certificate.py @@ -10,7 +10,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils from magnum.api.controllers.v1 import certificate as api_cert diff --git a/magnum/tests/unit/api/controllers/v1/test_cluster.py b/magnum/tests/unit/api/controllers/v1/test_cluster.py index 1fd6266af5..5784cd1219 100644 --- a/magnum/tests/unit/api/controllers/v1/test_cluster.py +++ b/magnum/tests/unit/api/controllers/v1/test_cluster.py @@ -11,8 +11,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock from oslo_config import cfg from oslo_utils import timeutils from oslo_utils import uuidutils diff --git a/magnum/tests/unit/api/controllers/v1/test_cluster_actions.py b/magnum/tests/unit/api/controllers/v1/test_cluster_actions.py index fd8a1bf110..41fdac53e1 100644 --- a/magnum/tests/unit/api/controllers/v1/test_cluster_actions.py +++ b/magnum/tests/unit/api/controllers/v1/test_cluster_actions.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from magnum.conductor import api as rpcapi import magnum.conf diff --git a/magnum/tests/unit/api/controllers/v1/test_cluster_template.py b/magnum/tests/unit/api/controllers/v1/test_cluster_template.py index 782b7d28eb..3ff9b69803 100644 --- a/magnum/tests/unit/api/controllers/v1/test_cluster_template.py +++ b/magnum/tests/unit/api/controllers/v1/test_cluster_template.py @@ -11,8 +11,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock from oslo_config import cfg from oslo_utils import timeutils from oslo_utils import uuidutils diff --git a/magnum/tests/unit/api/controllers/v1/test_federation.py b/magnum/tests/unit/api/controllers/v1/test_federation.py index c685b15e90..e5f25bb93b 100644 --- a/magnum/tests/unit/api/controllers/v1/test_federation.py +++ b/magnum/tests/unit/api/controllers/v1/test_federation.py @@ -11,7 +11,7 @@ # under the License. import datetime -import mock +from unittest import mock from oslo_config import cfg from oslo_utils import uuidutils diff --git a/magnum/tests/unit/api/controllers/v1/test_magnum_service.py b/magnum/tests/unit/api/controllers/v1/test_magnum_service.py index 3636016774..86412702a0 100644 --- a/magnum/tests/unit/api/controllers/v1/test_magnum_service.py +++ b/magnum/tests/unit/api/controllers/v1/test_magnum_service.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from magnum.api.controllers.v1 import magnum_services as mservice from magnum.api import servicegroup diff --git a/magnum/tests/unit/api/controllers/v1/test_nodegroup.py b/magnum/tests/unit/api/controllers/v1/test_nodegroup.py index 78c6e0ee12..147a7e165a 100644 --- a/magnum/tests/unit/api/controllers/v1/test_nodegroup.py +++ b/magnum/tests/unit/api/controllers/v1/test_nodegroup.py @@ -14,7 +14,7 @@ # under the License. import datetime -import mock +from unittest import mock from oslo_utils import timeutils from oslo_utils import uuidutils diff --git a/magnum/tests/unit/api/controllers/v1/test_quota.py b/magnum/tests/unit/api/controllers/v1/test_quota.py index c62eaaaa2d..9b4406a7ca 100644 --- a/magnum/tests/unit/api/controllers/v1/test_quota.py +++ b/magnum/tests/unit/api/controllers/v1/test_quota.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from keystoneauth1 import exceptions as ka_exception diff --git a/magnum/tests/unit/api/controllers/v1/test_stats.py b/magnum/tests/unit/api/controllers/v1/test_stats.py index 1cb1b2e81c..bb7aac28f4 100644 --- a/magnum/tests/unit/api/controllers/v1/test_stats.py +++ b/magnum/tests/unit/api/controllers/v1/test_stats.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from webtest.app import AppError diff --git a/magnum/tests/unit/api/controllers/v1/test_types.py b/magnum/tests/unit/api/controllers/v1/test_types.py index fada139dce..f086310f17 100644 --- a/magnum/tests/unit/api/controllers/v1/test_types.py +++ b/magnum/tests/unit/api/controllers/v1/test_types.py @@ -12,9 +12,10 @@ # 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 + from oslo_utils import uuidutils -import mock import six import webtest import wsme diff --git a/magnum/tests/unit/api/controllers/v1/test_utils.py b/magnum/tests/unit/api/controllers/v1/test_utils.py index 6d670e9943..0236d1ef4f 100644 --- a/magnum/tests/unit/api/controllers/v1/test_utils.py +++ b/magnum/tests/unit/api/controllers/v1/test_utils.py @@ -14,7 +14,8 @@ # under the License. import jsonpatch -import mock +from unittest import mock + from oslo_utils import uuidutils import wsme diff --git a/magnum/tests/unit/api/test_attr_validator.py b/magnum/tests/unit/api/test_attr_validator.py index 02c0be741f..e1454d1bf7 100644 --- a/magnum/tests/unit/api/test_attr_validator.py +++ b/magnum/tests/unit/api/test_attr_validator.py @@ -14,8 +14,8 @@ from glanceclient import exc as glance_exception -import mock from novaclient import exceptions as nova_exc +from unittest import mock from magnum.api import attr_validator from magnum.common import exception diff --git a/magnum/tests/unit/api/test_expose.py b/magnum/tests/unit/api/test_expose.py index 54caf93c93..7618f11faa 100644 --- a/magnum/tests/unit/api/test_expose.py +++ b/magnum/tests/unit/api/test_expose.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.api import expose from magnum.tests import base diff --git a/magnum/tests/unit/api/test_hooks.py b/magnum/tests/unit/api/test_hooks.py index f7b9a9aa5a..9332c93120 100644 --- a/magnum/tests/unit/api/test_hooks.py +++ b/magnum/tests/unit/api/test_hooks.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import six -import mock from oslo_config import cfg import oslo_messaging as messaging diff --git a/magnum/tests/unit/api/test_servicegroup.py b/magnum/tests/unit/api/test_servicegroup.py index 6db4a62834..3a12e9235d 100644 --- a/magnum/tests/unit/api/test_servicegroup.py +++ b/magnum/tests/unit/api/test_servicegroup.py @@ -11,8 +11,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock from oslo_utils import timeutils import pytz diff --git a/magnum/tests/unit/api/test_validation.py b/magnum/tests/unit/api/test_validation.py index b1c1149a64..e6d89e3129 100644 --- a/magnum/tests/unit/api/test_validation.py +++ b/magnum/tests/unit/api/test_validation.py @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + from six.moves import reload_module from magnum.api import validation as v diff --git a/magnum/tests/unit/cmd/test_api.py b/magnum/tests/unit/cmd/test_api.py index ea55eadbf7..539f7871d7 100644 --- a/magnum/tests/unit/cmd/test_api.py +++ b/magnum/tests/unit/cmd/test_api.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from oslo_concurrency import processutils diff --git a/magnum/tests/unit/cmd/test_conductor.py b/magnum/tests/unit/cmd/test_conductor.py index c46c0f5d82..622d506841 100644 --- a/magnum/tests/unit/cmd/test_conductor.py +++ b/magnum/tests/unit/cmd/test_conductor.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from oslo_concurrency import processutils diff --git a/magnum/tests/unit/cmd/test_db_manage.py b/magnum/tests/unit/cmd/test_db_manage.py index ae81ca1e0a..f2eddea0f6 100644 --- a/magnum/tests/unit/cmd/test_db_manage.py +++ b/magnum/tests/unit/cmd/test_db_manage.py @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + import six from magnum.cmd import db_manage diff --git a/magnum/tests/unit/cmd/test_driver_manage.py b/magnum/tests/unit/cmd/test_driver_manage.py index 6c99906ae4..ad0ce3f467 100644 --- a/magnum/tests/unit/cmd/test_driver_manage.py +++ b/magnum/tests/unit/cmd/test_driver_manage.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from magnum.cmd import driver_manage from magnum.tests import base diff --git a/magnum/tests/unit/common/cert_manager/test_barbican.py b/magnum/tests/unit/common/cert_manager/test_barbican.py index 445f418975..afd22b1a69 100644 --- a/magnum/tests/unit/common/cert_manager/test_barbican.py +++ b/magnum/tests/unit/common/cert_manager/test_barbican.py @@ -12,12 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock import uuid from barbicanclient.v1 import client as barbican_client from barbicanclient.v1 import containers from barbicanclient.v1 import secrets -import mock from mock import patch from magnum.common.cert_manager import barbican_cert_manager as bcm diff --git a/magnum/tests/unit/common/cert_manager/test_cert_manager.py b/magnum/tests/unit/common/cert_manager/test_cert_manager.py index 8ebca884e1..7da1726586 100644 --- a/magnum/tests/unit/common/cert_manager/test_cert_manager.py +++ b/magnum/tests/unit/common/cert_manager/test_cert_manager.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_config import fixture from magnum.common import cert_manager diff --git a/magnum/tests/unit/common/cert_manager/test_local.py b/magnum/tests/unit/common/cert_manager/test_local.py index 9c44f2b588..d43e0fc411 100644 --- a/magnum/tests/unit/common/cert_manager/test_local.py +++ b/magnum/tests/unit/common/cert_manager/test_local.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. import os +from unittest import mock -import mock from oslo_config import cfg from oslo_config import fixture as oslo_fixture diff --git a/magnum/tests/unit/common/cert_manager/test_x509keypair_cert_manager.py b/magnum/tests/unit/common/cert_manager/test_x509keypair_cert_manager.py index c83af8de06..8d1e739352 100644 --- a/magnum/tests/unit/common/cert_manager/test_x509keypair_cert_manager.py +++ b/magnum/tests/unit/common/cert_manager/test_x509keypair_cert_manager.py @@ -11,7 +11,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.common.cert_manager import x509keypair_cert_manager as x509_cm from magnum.common import context diff --git a/magnum/tests/unit/common/test_clients.py b/magnum/tests/unit/common/test_clients.py index c437584da3..576bb9acaa 100644 --- a/magnum/tests/unit/common/test_clients.py +++ b/magnum/tests/unit/common/test_clients.py @@ -13,9 +13,9 @@ from barbicanclient.v1 import client as barbicanclient from glanceclient import client as glanceclient from heatclient import client as heatclient -import mock from neutronclient.v2_0 import client as neutronclient from novaclient import client as novaclient +from unittest import mock from magnum.common import clients from magnum.common import exception diff --git a/magnum/tests/unit/common/test_docker_utils.py b/magnum/tests/unit/common/test_docker_utils.py index 671763d9ec..80f073721c 100644 --- a/magnum/tests/unit/common/test_docker_utils.py +++ b/magnum/tests/unit/common/test_docker_utils.py @@ -13,7 +13,7 @@ # under the License. import docker -import mock +from unittest import mock from magnum.common import docker_utils import magnum.conf diff --git a/magnum/tests/unit/common/test_keystone.py b/magnum/tests/unit/common/test_keystone.py index 449db0cdc0..4b69f03009 100644 --- a/magnum/tests/unit/common/test_keystone.py +++ b/magnum/tests/unit/common/test_keystone.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_config import fixture from keystoneauth1 import exceptions as ka_exception diff --git a/magnum/tests/unit/common/test_neutron.py b/magnum/tests/unit/common/test_neutron.py index 6630c2f291..732babc5e9 100644 --- a/magnum/tests/unit/common/test_neutron.py +++ b/magnum/tests/unit/common/test_neutron.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from magnum.common import exception from magnum.common import neutron diff --git a/magnum/tests/unit/common/test_octavia.py b/magnum/tests/unit/common/test_octavia.py index 4033bb3cfd..69a76589de 100644 --- a/magnum/tests/unit/common/test_octavia.py +++ b/magnum/tests/unit/common/test_octavia.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from magnum.common import exception from magnum.common import octavia diff --git a/magnum/tests/unit/common/test_profiler.py b/magnum/tests/unit/common/test_profiler.py index 5fded8d011..da292b92b8 100644 --- a/magnum/tests/unit/common/test_profiler.py +++ b/magnum/tests/unit/common/test_profiler.py @@ -14,7 +14,7 @@ # under the License. import inspect -import mock +from unittest import mock from oslo_config import cfg from oslo_utils import importutils diff --git a/magnum/tests/unit/common/test_rpc.py b/magnum/tests/unit/common/test_rpc.py index 7414f26592..3cbda2c944 100644 --- a/magnum/tests/unit/common/test_rpc.py +++ b/magnum/tests/unit/common/test_rpc.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + import oslo_messaging as messaging from oslo_messaging.rpc import dispatcher from oslo_serialization import jsonutils diff --git a/magnum/tests/unit/common/test_service.py b/magnum/tests/unit/common/test_service.py index 463e0904c9..44bc48ebee 100644 --- a/magnum/tests/unit/common/test_service.py +++ b/magnum/tests/unit/common/test_service.py @@ -11,7 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from oslo_log import log as logging diff --git a/magnum/tests/unit/common/test_urlfetch.py b/magnum/tests/unit/common/test_urlfetch.py index b65351dfb3..36d835319c 100644 --- a/magnum/tests/unit/common/test_urlfetch.py +++ b/magnum/tests/unit/common/test_urlfetch.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock + from oslo_config import cfg from magnum.common import urlfetch diff --git a/magnum/tests/unit/common/test_utils.py b/magnum/tests/unit/common/test_utils.py index 8bfa726034..34d4f99fc4 100644 --- a/magnum/tests/unit/common/test_utils.py +++ b/magnum/tests/unit/common/test_utils.py @@ -18,8 +18,8 @@ import os import os.path import shutil import tempfile +from unittest import mock -import mock from oslo_concurrency import processutils from oslo_utils import netutils diff --git a/magnum/tests/unit/common/x509/test_operations.py b/magnum/tests/unit/common/x509/test_operations.py index 32bedfacd2..2ee19cc6ba 100644 --- a/magnum/tests/unit/common/x509/test_operations.py +++ b/magnum/tests/unit/common/x509/test_operations.py @@ -14,7 +14,7 @@ from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives import serialization -import mock +from unittest import mock from magnum.common.x509 import operations from magnum.tests import base diff --git a/magnum/tests/unit/common/x509/test_sign.py b/magnum/tests/unit/common/x509/test_sign.py index 501ed800a3..7bedd9a850 100644 --- a/magnum/tests/unit/common/x509/test_sign.py +++ b/magnum/tests/unit/common/x509/test_sign.py @@ -18,7 +18,8 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import serialization from cryptography import x509 as c_x509 from cryptography.x509.oid import NameOID -import mock +from unittest import mock + import six from magnum.common import exception diff --git a/magnum/tests/unit/conductor/handlers/common/test_cert_manager.py b/magnum/tests/unit/conductor/handlers/common/test_cert_manager.py index 8d539477fd..297fa2b52f 100644 --- a/magnum/tests/unit/conductor/handlers/common/test_cert_manager.py +++ b/magnum/tests/unit/conductor/handlers/common/test_cert_manager.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.common import exception from magnum.conductor.handlers.common import cert_manager diff --git a/magnum/tests/unit/conductor/handlers/common/test_trust_manager.py b/magnum/tests/unit/conductor/handlers/common/test_trust_manager.py index 3860bb8bbc..2a69ebf9c8 100644 --- a/magnum/tests/unit/conductor/handlers/common/test_trust_manager.py +++ b/magnum/tests/unit/conductor/handlers/common/test_trust_manager.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock from magnum.common import exception from magnum.conductor.handlers.common import trust_manager diff --git a/magnum/tests/unit/conductor/handlers/test_ca_conductor.py b/magnum/tests/unit/conductor/handlers/test_ca_conductor.py index 72ae38d517..cce26a9f8c 100644 --- a/magnum/tests/unit/conductor/handlers/test_ca_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_ca_conductor.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.conductor.handlers import ca_conductor from magnum.tests import base diff --git a/magnum/tests/unit/conductor/handlers/test_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_cluster_conductor.py index b2046c6714..2573f2743e 100644 --- a/magnum/tests/unit/conductor/handlers/test_cluster_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_cluster_conductor.py @@ -14,10 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import six from heatclient import exc -import mock from mock import patch from oslo_service import loopingcall from pycadf import cadftaxonomy as taxonomy diff --git a/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py index cef7bbff75..bbcd9d335f 100644 --- a/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock import magnum.conf from magnum.drivers.k8s_coreos_v1 import driver as k8s_coreos_dr diff --git a/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py index 5c8b3e9d82..54eb77da3d 100644 --- a/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock from magnum.drivers.heat import driver as heat_driver from magnum.drivers.mesos_ubuntu_v1 import driver as mesos_dr diff --git a/magnum/tests/unit/conductor/handlers/test_nodegroup_conductor.py b/magnum/tests/unit/conductor/handlers/test_nodegroup_conductor.py index 5f87ea3d1f..41fe395901 100644 --- a/magnum/tests/unit/conductor/handlers/test_nodegroup_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_nodegroup_conductor.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock from heatclient import exc diff --git a/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py b/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py index 44a1aacac0..34608732e0 100644 --- a/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py +++ b/magnum/tests/unit/conductor/handlers/test_swarm_cluster_conductor.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock import magnum.conf from magnum.drivers.heat import driver as heat_driver diff --git a/magnum/tests/unit/conductor/tasks/test_heat_tasks.py b/magnum/tests/unit/conductor/tasks/test_heat_tasks.py index 973860c9b4..2ac2d070d5 100644 --- a/magnum/tests/unit/conductor/tasks/test_heat_tasks.py +++ b/magnum/tests/unit/conductor/tasks/test_heat_tasks.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from taskflow import engines from taskflow.patterns import linear_flow +from unittest import mock from magnum.conductor.tasks import heat_tasks from magnum.tests import base diff --git a/magnum/tests/unit/conductor/test_k8s_api.py b/magnum/tests/unit/conductor/test_k8s_api.py index 7722c76ccf..df4579cce0 100644 --- a/magnum/tests/unit/conductor/test_k8s_api.py +++ b/magnum/tests/unit/conductor/test_k8s_api.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.tests import base diff --git a/magnum/tests/unit/conductor/test_monitors.py b/magnum/tests/unit/conductor/test_monitors.py index f1a0ca8126..41c90d94df 100644 --- a/magnum/tests/unit/conductor/test_monitors.py +++ b/magnum/tests/unit/conductor/test_monitors.py @@ -14,8 +14,8 @@ # limitations under the License. from collections import namedtuple +from unittest import mock -import mock from oslo_serialization import jsonutils from magnum.common import exception diff --git a/magnum/tests/unit/conductor/test_rpcapi.py b/magnum/tests/unit/conductor/test_rpcapi.py index 5af75576ba..e0d3038bac 100644 --- a/magnum/tests/unit/conductor/test_rpcapi.py +++ b/magnum/tests/unit/conductor/test_rpcapi.py @@ -14,8 +14,8 @@ Unit Tests for :py:class:`magnum.conductor.rpcapi.API`. """ import copy +from unittest import mock -import mock from magnum.conductor import api as conductor_rpcapi from magnum import objects diff --git a/magnum/tests/unit/conductor/test_scale_manager.py b/magnum/tests/unit/conductor/test_scale_manager.py index cd647d99c2..cfe4309908 100644 --- a/magnum/tests/unit/conductor/test_scale_manager.py +++ b/magnum/tests/unit/conductor/test_scale_manager.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.common import exception from magnum.conductor import scale_manager diff --git a/magnum/tests/unit/conductor/test_utils.py b/magnum/tests/unit/conductor/test_utils.py index 95e712b421..7483d36eea 100644 --- a/magnum/tests/unit/conductor/test_utils.py +++ b/magnum/tests/unit/conductor/test_utils.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock from magnum.conductor import utils from magnum import objects diff --git a/magnum/tests/unit/conf/test_conf.py b/magnum/tests/unit/conf/test_conf.py index 0ee33a8472..58cbe993df 100644 --- a/magnum/tests/unit/conf/test_conf.py +++ b/magnum/tests/unit/conf/test_conf.py @@ -13,7 +13,8 @@ # under the License. import collections -import mock +from unittest import mock + from oslo_config import cfg import six diff --git a/magnum/tests/unit/drivers/test_heat_driver.py b/magnum/tests/unit/drivers/test_heat_driver.py index 04d46fd231..ed63e8246b 100644 --- a/magnum/tests/unit/drivers/test_heat_driver.py +++ b/magnum/tests/unit/drivers/test_heat_driver.py @@ -10,10 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from mock import patch +from unittest import mock from heatclient import exc as heatexc +from oslo_utils import uuidutils import magnum.conf from magnum.drivers.heat import driver as heat_driver @@ -87,7 +88,8 @@ class TestHeatPoller(base.TestCase): if default_stack_status is None: default_stack_status = cluster_status.CREATE_COMPLETE - cluster = mock.MagicMock(nodegroups=list()) + cluster = mock.MagicMock(nodegroups=list(), + uuid=uuidutils.generate_uuid()) def_worker = self._create_nodegroup(cluster, 'worker_ng', 'stack1', name='worker_ng', role='worker', diff --git a/magnum/tests/unit/drivers/test_template_definition.py b/magnum/tests/unit/drivers/test_template_definition.py index a2b2a620fe..15adfd2078 100644 --- a/magnum/tests/unit/drivers/test_template_definition.py +++ b/magnum/tests/unit/drivers/test_template_definition.py @@ -13,8 +13,9 @@ # under the License. import abc -import mock from neutronclient.common import exceptions as n_exception +from unittest import mock + import six from magnum.common import exception diff --git a/magnum/tests/unit/objects/test_cluster.py b/magnum/tests/unit/objects/test_cluster.py index b4cd7ac6e2..10abab59d2 100644 --- a/magnum/tests/unit/objects/test_cluster.py +++ b/magnum/tests/unit/objects/test_cluster.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils from testtools.matchers import HasLength diff --git a/magnum/tests/unit/objects/test_cluster_template.py b/magnum/tests/unit/objects/test_cluster_template.py index 7760ad6169..dc868b5772 100644 --- a/magnum/tests/unit/objects/test_cluster_template.py +++ b/magnum/tests/unit/objects/test_cluster_template.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils from testtools.matchers import HasLength diff --git a/magnum/tests/unit/objects/test_federation.py b/magnum/tests/unit/objects/test_federation.py index 6183786449..b744a1393b 100644 --- a/magnum/tests/unit/objects/test_federation.py +++ b/magnum/tests/unit/objects/test_federation.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils from testtools.matchers import HasLength diff --git a/magnum/tests/unit/objects/test_magnum_service.py b/magnum/tests/unit/objects/test_magnum_service.py index 2b94032e2e..2dbf1746a5 100644 --- a/magnum/tests/unit/objects/test_magnum_service.py +++ b/magnum/tests/unit/objects/test_magnum_service.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum import objects from magnum.tests.unit.db import base diff --git a/magnum/tests/unit/objects/test_nodegroup.py b/magnum/tests/unit/objects/test_nodegroup.py index e1aedbbb64..2582b34475 100644 --- a/magnum/tests/unit/objects/test_nodegroup.py +++ b/magnum/tests/unit/objects/test_nodegroup.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils from testtools.matchers import HasLength diff --git a/magnum/tests/unit/objects/test_objects.py b/magnum/tests/unit/objects/test_objects.py index 5aa0eceed1..bd05ab1de6 100644 --- a/magnum/tests/unit/objects/test_objects.py +++ b/magnum/tests/unit/objects/test_objects.py @@ -14,8 +14,8 @@ import datetime import gettext +from unittest import mock -import mock from oslo_versionedobjects import exception as object_exception from oslo_versionedobjects import fields from oslo_versionedobjects import fixture diff --git a/magnum/tests/unit/objects/test_x509keypair.py b/magnum/tests/unit/objects/test_x509keypair.py index 9d5909ce7e..5342c11d52 100644 --- a/magnum/tests/unit/objects/test_x509keypair.py +++ b/magnum/tests/unit/objects/test_x509keypair.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils from testtools.matchers import HasLength diff --git a/magnum/tests/unit/service/test_periodic.py b/magnum/tests/unit/service/test_periodic.py index 7cef0d2218..eac1e5b7f2 100644 --- a/magnum/tests/unit/service/test_periodic.py +++ b/magnum/tests/unit/service/test_periodic.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from oslo_utils import uuidutils diff --git a/magnum/tests/unit/servicegroup/test_magnum_service.py b/magnum/tests/unit/servicegroup/test_magnum_service.py index 161603addd..7a513e7ebe 100644 --- a/magnum/tests/unit/servicegroup/test_magnum_service.py +++ b/magnum/tests/unit/servicegroup/test_magnum_service.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from magnum.common.rpc_service import CONF from magnum import objects diff --git a/magnum/tests/unit/test_hacking.py b/magnum/tests/unit/test_hacking.py index 6f56041caa..da10937776 100644 --- a/magnum/tests/unit/test_hacking.py +++ b/magnum/tests/unit/test_hacking.py @@ -13,8 +13,8 @@ # under the License. import textwrap +from unittest import mock -import mock import pycodestyle from magnum.hacking import checks diff --git a/test-requirements.txt b/test-requirements.txt index 952e0b8339..dbc0f8a2a0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -11,7 +11,6 @@ coverage!=4.4,>=4.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD hacking>=3.0,<3.1.0 # Apache-2.0 -mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0 os-testr>=1.0.0 # Apache-2.0