summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGinnis <sean.mcginnis@gmail.com>2020-04-18 11:52:52 -0500
committerSean McGinnis <sean.mcginnis@gmail.com>2020-05-05 08:42:11 -0500
commitfd6cf83554db68752278d37f577ba984d9f831b2 (patch)
tree1cc932608a8c5af19b39f574f66a92070a328745
parent368fdfff42d9cc4ff661a51ed87816834b9e3590 (diff)
downloadheat-fd6cf83554db68752278d37f577ba984d9f831b2.tar.gz
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: I8f764e9ba46a4e2055be61eb0fe97d155ab1c70e Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
-rw-r--r--contrib/heat_docker/heat_docker/tests/fake_docker_client.py2
-rw-r--r--contrib/heat_docker/heat_docker/tests/test_docker_container.py2
-rw-r--r--heat/tests/api/aws/test_api_ec2token.py2
-rw-r--r--heat/tests/api/cfn/test_api_cfn_v1.py2
-rw-r--r--heat/tests/api/openstack_v1/test_actions.py2
-rw-r--r--heat/tests/api/openstack_v1/test_build_info.py2
-rw-r--r--heat/tests/api/openstack_v1/test_events.py3
-rw-r--r--heat/tests/api/openstack_v1/test_resources.py3
-rw-r--r--heat/tests/api/openstack_v1/test_services.py3
-rw-r--r--heat/tests/api/openstack_v1/test_software_configs.py2
-rw-r--r--heat/tests/api/openstack_v1/test_software_deployments.py2
-rw-r--r--heat/tests/api/openstack_v1/test_stacks.py2
-rw-r--r--heat/tests/api/openstack_v1/test_util.py3
-rw-r--r--heat/tests/api/openstack_v1/test_views_common.py2
-rw-r--r--heat/tests/api/openstack_v1/test_views_stacks_view.py2
-rw-r--r--heat/tests/api/openstack_v1/tools.py3
-rw-r--r--heat/tests/api/test_wsgi.py6
-rw-r--r--heat/tests/autoscaling/test_heat_scaling_group.py2
-rw-r--r--heat/tests/autoscaling/test_heat_scaling_policy.py2
-rw-r--r--heat/tests/autoscaling/test_launch_config.py2
-rw-r--r--heat/tests/autoscaling/test_lbutils.py2
-rw-r--r--heat/tests/autoscaling/test_scaling_group.py2
-rw-r--r--heat/tests/autoscaling/test_scaling_policy.py2
-rw-r--r--heat/tests/aws/test_eip.py2
-rw-r--r--heat/tests/aws/test_instance.py2
-rw-r--r--heat/tests/aws/test_loadbalancer.py2
-rw-r--r--heat/tests/aws/test_s3.py2
-rw-r--r--heat/tests/aws/test_security_group.py2
-rw-r--r--heat/tests/aws/test_user.py3
-rw-r--r--heat/tests/aws/test_volume.py2
-rw-r--r--heat/tests/aws/test_waitcondition.py2
-rw-r--r--heat/tests/clients/test_barbican_client.py2
-rw-r--r--heat/tests/clients/test_blazar_client.py3
-rw-r--r--heat/tests/clients/test_cinder_client.py2
-rw-r--r--heat/tests/clients/test_clients.py3
-rw-r--r--heat/tests/clients/test_designate_client.py3
-rw-r--r--heat/tests/clients/test_glance_client.py2
-rw-r--r--heat/tests/clients/test_heat_client.py2
-rw-r--r--heat/tests/clients/test_ironic_client.py3
-rw-r--r--heat/tests/clients/test_keystone_client.py3
-rw-r--r--heat/tests/clients/test_magnum_client.py3
-rw-r--r--heat/tests/clients/test_manila_client.py2
-rw-r--r--heat/tests/clients/test_mistral_client.py3
-rw-r--r--heat/tests/clients/test_monasca_client.py2
-rw-r--r--heat/tests/clients/test_neutron_client.py3
-rw-r--r--heat/tests/clients/test_nova_client.py2
-rw-r--r--heat/tests/clients/test_sahara_client.py2
-rw-r--r--heat/tests/clients/test_sdk_client.py2
-rw-r--r--heat/tests/clients/test_senlin_client.py3
-rw-r--r--heat/tests/clients/test_swift_client.py2
-rw-r--r--heat/tests/clients/test_zaqar_client.py3
-rw-r--r--heat/tests/clients/test_zun_client.py2
-rw-r--r--heat/tests/constraints/test_common_constraints.py2
-rw-r--r--heat/tests/convergence/framework/worker_wrapper.py2
-rw-r--r--heat/tests/db/test_sqlalchemy_api.py5
-rw-r--r--heat/tests/db/test_sqlalchemy_filters.py2
-rw-r--r--heat/tests/engine/service/test_service_engine.py2
-rw-r--r--heat/tests/engine/service/test_software_config.py2
-rw-r--r--heat/tests/engine/service/test_stack_action.py3
-rw-r--r--heat/tests/engine/service/test_stack_adopt.py3
-rw-r--r--heat/tests/engine/service/test_stack_create.py3
-rw-r--r--heat/tests/engine/service/test_stack_delete.py3
-rw-r--r--heat/tests/engine/service/test_stack_events.py3
-rw-r--r--heat/tests/engine/service/test_stack_resources.py3
-rw-r--r--heat/tests/engine/service/test_stack_snapshot.py2
-rw-r--r--heat/tests/engine/service/test_stack_update.py2
-rw-r--r--heat/tests/engine/service/test_threadgroup_mgr.py4
-rw-r--r--heat/tests/engine/test_check_resource.py4
-rw-r--r--heat/tests/engine/test_engine_worker.py2
-rw-r--r--heat/tests/engine/test_resource_type.py2
-rw-r--r--heat/tests/engine/test_scheduler.py2
-rw-r--r--heat/tests/engine/test_sync_point.py3
-rw-r--r--heat/tests/fakes.py3
-rw-r--r--heat/tests/openstack/aodh/test_alarm.py3
-rw-r--r--heat/tests/openstack/aodh/test_composite_alarm.py3
-rw-r--r--heat/tests/openstack/aodh/test_gnocchi_alarm.py2
-rw-r--r--heat/tests/openstack/barbican/test_container.py2
-rw-r--r--heat/tests/openstack/barbican/test_order.py2
-rw-r--r--heat/tests/openstack/barbican/test_secret.py2
-rw-r--r--heat/tests/openstack/blazar/test_host.py3
-rw-r--r--heat/tests/openstack/blazar/test_lease.py3
-rw-r--r--heat/tests/openstack/cinder/test_qos_specs.py2
-rw-r--r--heat/tests/openstack/cinder/test_quota.py2
-rw-r--r--heat/tests/openstack/cinder/test_volume.py2
-rw-r--r--heat/tests/openstack/cinder/test_volume_type.py2
-rw-r--r--heat/tests/openstack/cinder/test_volume_type_encryption.py2
-rw-r--r--heat/tests/openstack/cinder/test_volume_utils.py3
-rw-r--r--heat/tests/openstack/designate/test_recordset.py3
-rw-r--r--heat/tests/openstack/designate/test_zone.py2
-rw-r--r--heat/tests/openstack/glance/test_image.py2
-rw-r--r--heat/tests/openstack/heat/test_cloud_config.py2
-rw-r--r--heat/tests/openstack/heat/test_deployed_server.py2
-rw-r--r--heat/tests/openstack/heat/test_instance_group.py3
-rw-r--r--heat/tests/openstack/heat/test_instance_group_update_policy.py2
-rw-r--r--heat/tests/openstack/heat/test_multi_part.py3
-rw-r--r--heat/tests/openstack/heat/test_none_resource.py2
-rw-r--r--heat/tests/openstack/heat/test_random_string.py2
-rw-r--r--heat/tests/openstack/heat/test_remote_stack.py2
-rw-r--r--heat/tests/openstack/heat/test_resource_chain.py2
-rw-r--r--heat/tests/openstack/heat/test_resource_group.py3
-rw-r--r--heat/tests/openstack/heat/test_software_component.py2
-rw-r--r--heat/tests/openstack/heat/test_software_config.py2
-rw-r--r--heat/tests/openstack/heat/test_software_deployment.py3
-rw-r--r--heat/tests/openstack/heat/test_structured_config.py2
-rw-r--r--heat/tests/openstack/heat/test_swiftsignal.py2
-rw-r--r--heat/tests/openstack/heat/test_waitcondition.py2
-rw-r--r--heat/tests/openstack/keystone/test_domain.py2
-rw-r--r--heat/tests/openstack/keystone/test_endpoint.py3
-rw-r--r--heat/tests/openstack/keystone/test_group.py2
-rw-r--r--heat/tests/openstack/keystone/test_project.py2
-rw-r--r--heat/tests/openstack/keystone/test_region.py2
-rw-r--r--heat/tests/openstack/keystone/test_role.py2
-rw-r--r--heat/tests/openstack/keystone/test_role_assignments.py2
-rw-r--r--heat/tests/openstack/keystone/test_service.py3
-rw-r--r--heat/tests/openstack/keystone/test_user.py2
-rw-r--r--heat/tests/openstack/magnum/test_bay.py3
-rw-r--r--heat/tests/openstack/magnum/test_cluster.py3
-rw-r--r--heat/tests/openstack/magnum/test_cluster_template.py3
-rw-r--r--heat/tests/openstack/manila/test_security_service.py2
-rw-r--r--heat/tests/openstack/manila/test_share.py3
-rw-r--r--heat/tests/openstack/manila/test_share_network.py2
-rw-r--r--heat/tests/openstack/manila/test_share_type.py2
-rw-r--r--heat/tests/openstack/mistral/test_cron_trigger.py2
-rw-r--r--heat/tests/openstack/mistral/test_external_resource.py2
-rw-r--r--heat/tests/openstack/mistral/test_workflow.py2
-rw-r--r--heat/tests/openstack/monasca/test_alarm_definition.py2
-rw-r--r--heat/tests/openstack/monasca/test_notification.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_health_monitor.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_l7policy.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_l7rule.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_listener.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_loadbalancer.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_pool.py2
-rw-r--r--heat/tests/openstack/neutron/lbaas/test_pool_member.py2
-rw-r--r--heat/tests/openstack/neutron/test_address_scope.py2
-rw-r--r--heat/tests/openstack/neutron/test_extraroute.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_firewall.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_floating_ip.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_l2_gateway.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_l2_gateway_connection.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_loadbalancer.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_metering.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_network_gateway.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_port.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_provider_net.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_rbac_policy.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_router.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_security_group.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_security_group_rule.py2
-rw-r--r--heat/tests/openstack/neutron/test_neutron_segment.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_subnet.py3
-rw-r--r--heat/tests/openstack/neutron/test_neutron_vpnservice.py2
-rw-r--r--heat/tests/openstack/neutron/test_qos.py2
-rw-r--r--heat/tests/openstack/neutron/test_quota.py2
-rw-r--r--heat/tests/openstack/neutron/test_sfc/test_flow_classifier.py2
-rw-r--r--heat/tests/openstack/neutron/test_sfc/test_port_chain.py2
-rw-r--r--heat/tests/openstack/neutron/test_sfc/test_port_pair.py2
-rw-r--r--heat/tests/openstack/neutron/test_sfc/test_port_pair_group.py2
-rw-r--r--heat/tests/openstack/neutron/test_taas/test_tap_flow.py2
-rw-r--r--heat/tests/openstack/neutron/test_taas/test_tap_service.py2
-rw-r--r--heat/tests/openstack/nova/fakes.py4
-rw-r--r--heat/tests/openstack/nova/test_flavor.py2
-rw-r--r--heat/tests/openstack/nova/test_floatingip.py2
-rw-r--r--heat/tests/openstack/nova/test_host_aggregate.py2
-rw-r--r--heat/tests/openstack/nova/test_keypair.py3
-rw-r--r--heat/tests/openstack/nova/test_quota.py2
-rw-r--r--heat/tests/openstack/nova/test_server.py2
-rw-r--r--heat/tests/openstack/nova/test_server_group.py3
-rw-r--r--heat/tests/openstack/octavia/test_flavor.py2
-rw-r--r--heat/tests/openstack/octavia/test_flavor_profile.py2
-rw-r--r--heat/tests/openstack/octavia/test_health_monitor.py2
-rw-r--r--heat/tests/openstack/octavia/test_l7policy.py2
-rw-r--r--heat/tests/openstack/octavia/test_l7rule.py2
-rw-r--r--heat/tests/openstack/octavia/test_listener.py2
-rw-r--r--heat/tests/openstack/octavia/test_loadbalancer.py2
-rw-r--r--heat/tests/openstack/octavia/test_pool.py2
-rw-r--r--heat/tests/openstack/octavia/test_pool_member.py2
-rw-r--r--heat/tests/openstack/octavia/test_quota.py3
-rw-r--r--heat/tests/openstack/sahara/test_cluster.py3
-rw-r--r--heat/tests/openstack/sahara/test_data_source.py2
-rw-r--r--heat/tests/openstack/sahara/test_image.py2
-rw-r--r--heat/tests/openstack/sahara/test_job.py2
-rw-r--r--heat/tests/openstack/sahara/test_job_binary.py2
-rw-r--r--heat/tests/openstack/sahara/test_templates.py2
-rw-r--r--heat/tests/openstack/senlin/test_cluster.py3
-rw-r--r--heat/tests/openstack/senlin/test_node.py3
-rw-r--r--heat/tests/openstack/senlin/test_policy.py2
-rw-r--r--heat/tests/openstack/senlin/test_profile.py2
-rw-r--r--heat/tests/openstack/senlin/test_receiver.py2
-rw-r--r--heat/tests/openstack/swift/test_container.py2
-rw-r--r--heat/tests/openstack/trove/test_cluster.py3
-rw-r--r--heat/tests/openstack/trove/test_instance.py2
-rw-r--r--heat/tests/openstack/zaqar/test_queue.py3
-rw-r--r--heat/tests/openstack/zaqar/test_subscription.py2
-rw-r--r--heat/tests/openstack/zun/test_container.py2
-rw-r--r--heat/tests/test_attributes.py2
-rw-r--r--heat/tests/test_auth_password.py3
-rw-r--r--heat/tests/test_auth_url.py3
-rw-r--r--heat/tests/test_common_auth_plugin.py3
-rw-r--r--heat/tests/test_common_context.py2
-rw-r--r--heat/tests/test_convg_stack.py3
-rw-r--r--heat/tests/test_engine_api_utils.py2
-rw-r--r--heat/tests/test_engine_service.py2
-rw-r--r--heat/tests/test_environment.py2
-rw-r--r--heat/tests/test_environment_format.py2
-rw-r--r--heat/tests/test_event.py3
-rw-r--r--heat/tests/test_exception.py3
-rw-r--r--heat/tests/test_grouputils.py2
-rw-r--r--heat/tests/test_hot.py2
-rw-r--r--heat/tests/test_lifecycle_plugin_utils.py2
-rw-r--r--heat/tests/test_loguserdata.py2
-rw-r--r--heat/tests/test_metadata_refresh.py3
-rw-r--r--heat/tests/test_nested_stack.py3
-rw-r--r--heat/tests/test_notifications.py3
-rw-r--r--heat/tests/test_plugin_loader.py3
-rw-r--r--heat/tests/test_properties.py3
-rw-r--r--heat/tests/test_provider_template.py3
-rw-r--r--heat/tests/test_resource.py4
-rw-r--r--heat/tests/test_rpc_client.py2
-rw-r--r--heat/tests/test_rpc_listener_client.py3
-rw-r--r--heat/tests/test_rpc_worker_client.py2
-rw-r--r--heat/tests/test_server_tags.py3
-rw-r--r--heat/tests/test_signal.py4
-rw-r--r--heat/tests/test_stack.py2
-rw-r--r--heat/tests/test_stack_delete.py2
-rw-r--r--heat/tests/test_stack_lock.py2
-rw-r--r--heat/tests/test_stack_resource.py2
-rw-r--r--heat/tests/test_stack_update.py2
-rw-r--r--heat/tests/test_stack_user.py3
-rw-r--r--heat/tests/test_template_format.py2
-rw-r--r--heat/tests/test_translation_rule.py2
-rw-r--r--heat/tests/test_validate.py3
-rw-r--r--heat/tests/test_vpc.py2
-rw-r--r--test-requirements.txt1
234 files changed, 296 insertions, 259 deletions
diff --git a/contrib/heat_docker/heat_docker/tests/fake_docker_client.py b/contrib/heat_docker/heat_docker/tests/fake_docker_client.py
index 98d7747d8..ecb79789d 100644
--- a/contrib/heat_docker/heat_docker/tests/fake_docker_client.py
+++ b/contrib/heat_docker/heat_docker/tests/fake_docker_client.py
@@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
import random
import string
+from unittest import mock
class APIError(Exception):
diff --git a/contrib/heat_docker/heat_docker/tests/test_docker_container.py b/contrib/heat_docker/heat_docker/tests/test_docker_container.py
index 9872a9bf1..19c872a12 100644
--- a/contrib/heat_docker/heat_docker/tests/test_docker_container.py
+++ b/contrib/heat_docker/heat_docker/tests/test_docker_container.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common.i18n import _
diff --git a/heat/tests/api/aws/test_api_ec2token.py b/heat/tests/api/aws/test_api_ec2token.py
index 40cc5de2c..af1305f60 100644
--- a/heat/tests/api/aws/test_api_ec2token.py
+++ b/heat/tests/api/aws/test_api_ec2token.py
@@ -13,7 +13,7 @@
import json
-import mock
+from unittest import mock
from oslo_config import cfg
from oslo_utils import importutils
diff --git a/heat/tests/api/cfn/test_api_cfn_v1.py b/heat/tests/api/cfn/test_api_cfn_v1.py
index f3b2c5ee9..88d3764c6 100644
--- a/heat/tests/api/cfn/test_api_cfn_v1.py
+++ b/heat/tests/api/cfn/test_api_cfn_v1.py
@@ -13,8 +13,8 @@
import json
import os
+from unittest import mock
-import mock
from oslo_config import fixture as config_fixture
from heat.api.aws import exception
diff --git a/heat/tests/api/openstack_v1/test_actions.py b/heat/tests/api/openstack_v1/test_actions.py
index 35d41299e..4910bf46a 100644
--- a/heat/tests/api/openstack_v1/test_actions.py
+++ b/heat/tests/api/openstack_v1/test_actions.py
@@ -12,8 +12,8 @@
# under the License.
import json
+from unittest import mock
-import mock
import webob.exc
import heat.api.middleware.fault as fault
diff --git a/heat/tests/api/openstack_v1/test_build_info.py b/heat/tests/api/openstack_v1/test_build_info.py
index c958068d6..01cd9e9b8 100644
--- a/heat/tests/api/openstack_v1/test_build_info.py
+++ b/heat/tests/api/openstack_v1/test_build_info.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import heat.api.middleware.fault as fault
import heat.api.openstack.v1.build_info as build_info
diff --git a/heat/tests/api/openstack_v1/test_events.py b/heat/tests/api/openstack_v1/test_events.py
index 217ae51bb..08d53761b 100644
--- a/heat/tests/api/openstack_v1/test_events.py
+++ b/heat/tests/api/openstack_v1/test_events.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
import webob.exc
import heat.api.middleware.fault as fault
diff --git a/heat/tests/api/openstack_v1/test_resources.py b/heat/tests/api/openstack_v1/test_resources.py
index 5af626c3f..63426a3ab 100644
--- a/heat/tests/api/openstack_v1/test_resources.py
+++ b/heat/tests/api/openstack_v1/test_resources.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
import webob.exc
import heat.api.middleware.fault as fault
diff --git a/heat/tests/api/openstack_v1/test_services.py b/heat/tests/api/openstack_v1/test_services.py
index 1b078d013..ef659ddcb 100644
--- a/heat/tests/api/openstack_v1/test_services.py
+++ b/heat/tests/api/openstack_v1/test_services.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_messaging import exceptions
import webob.exc
diff --git a/heat/tests/api/openstack_v1/test_software_configs.py b/heat/tests/api/openstack_v1/test_software_configs.py
index aa644cf23..c1516eda0 100644
--- a/heat/tests/api/openstack_v1/test_software_configs.py
+++ b/heat/tests/api/openstack_v1/test_software_configs.py
@@ -12,8 +12,8 @@
# under the License.
import json
+from unittest import mock
-import mock
import webob.exc
import heat.api.middleware.fault as fault
diff --git a/heat/tests/api/openstack_v1/test_software_deployments.py b/heat/tests/api/openstack_v1/test_software_deployments.py
index 9f4023a27..3abe98f30 100644
--- a/heat/tests/api/openstack_v1/test_software_deployments.py
+++ b/heat/tests/api/openstack_v1/test_software_deployments.py
@@ -12,8 +12,8 @@
# under the License.
import json
+from unittest import mock
-import mock
import webob.exc
import heat.api.middleware.fault as fault
diff --git a/heat/tests/api/openstack_v1/test_stacks.py b/heat/tests/api/openstack_v1/test_stacks.py
index f27253a4e..5a9f41eea 100644
--- a/heat/tests/api/openstack_v1/test_stacks.py
+++ b/heat/tests/api/openstack_v1/test_stacks.py
@@ -12,8 +12,8 @@
# under the License.
import json
+from unittest import mock
-import mock
from oslo_config import cfg
import webob.exc
diff --git a/heat/tests/api/openstack_v1/test_util.py b/heat/tests/api/openstack_v1/test_util.py
index ff286a596..8add5b3a7 100644
--- a/heat/tests/api/openstack_v1/test_util.py
+++ b/heat/tests/api/openstack_v1/test_util.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from webob import exc
from heat.api.openstack.v1 import util
diff --git a/heat/tests/api/openstack_v1/test_views_common.py b/heat/tests/api/openstack_v1/test_views_common.py
index 1f3fb238c..df46178fc 100644
--- a/heat/tests/api/openstack_v1/test_views_common.py
+++ b/heat/tests/api/openstack_v1/test_views_common.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from urllib import parse as urlparse
from heat.api.openstack.v1.views import views_common
diff --git a/heat/tests/api/openstack_v1/test_views_stacks_view.py b/heat/tests/api/openstack_v1/test_views_stacks_view.py
index 5f71c0fee..00c56a564 100644
--- a/heat/tests/api/openstack_v1/test_views_stacks_view.py
+++ b/heat/tests/api/openstack_v1/test_views_stacks_view.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.api.openstack.v1.views import stacks_view
from heat.common import identifier
diff --git a/heat/tests/api/openstack_v1/tools.py b/heat/tests/api/openstack_v1/tools.py
index 7ed27ee33..63a8b0521 100644
--- a/heat/tests/api/openstack_v1/tools.py
+++ b/heat/tests/api/openstack_v1/tools.py
@@ -11,7 +11,8 @@
# 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_log import log
from oslo_messaging._drivers import common as rpc_common
diff --git a/heat/tests/api/test_wsgi.py b/heat/tests/api/test_wsgi.py
index 9d273d536..681c1d096 100644
--- a/heat/tests/api/test_wsgi.py
+++ b/heat/tests/api/test_wsgi.py
@@ -15,14 +15,14 @@
# under the License.
+from unittest import mock
+
import fixtures
import json
-import mock
+from oslo_config import cfg
import socket
import webob
-from oslo_config import cfg
-
from heat.api.aws import exception as aws_exception
from heat.common import exception
from heat.common import wsgi
diff --git a/heat/tests/autoscaling/test_heat_scaling_group.py b/heat/tests/autoscaling/test_heat_scaling_group.py
index 031460ebf..b91c33312 100644
--- a/heat/tests/autoscaling/test_heat_scaling_group.py
+++ b/heat/tests/autoscaling/test_heat_scaling_group.py
@@ -12,8 +12,8 @@
import datetime
import json
+from unittest import mock
-import mock
from oslo_utils import timeutils
from heat.common import exception
diff --git a/heat/tests/autoscaling/test_heat_scaling_policy.py b/heat/tests/autoscaling/test_heat_scaling_policy.py
index a3e89b67c..1d864c6b3 100644
--- a/heat/tests/autoscaling/test_heat_scaling_policy.py
+++ b/heat/tests/autoscaling/test_heat_scaling_policy.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/autoscaling/test_launch_config.py b/heat/tests/autoscaling/test_launch_config.py
index d4413e808..4569982c8 100644
--- a/heat/tests/autoscaling/test_launch_config.py
+++ b/heat/tests/autoscaling/test_launch_config.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import short_id
diff --git a/heat/tests/autoscaling/test_lbutils.py b/heat/tests/autoscaling/test_lbutils.py
index 51ad5c2d8..82ef9cabe 100644
--- a/heat/tests/autoscaling/test_lbutils.py
+++ b/heat/tests/autoscaling/test_lbutils.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/autoscaling/test_scaling_group.py b/heat/tests/autoscaling/test_scaling_group.py
index 91e5f9630..db2177a9f 100644
--- a/heat/tests/autoscaling/test_scaling_group.py
+++ b/heat/tests/autoscaling/test_scaling_group.py
@@ -13,8 +13,8 @@
import datetime
import json
+from unittest import mock
-import mock
from oslo_utils import timeutils
from heat.common import exception
diff --git a/heat/tests/autoscaling/test_scaling_policy.py b/heat/tests/autoscaling/test_scaling_policy.py
index 2c7cc5190..239a93ed7 100644
--- a/heat/tests/autoscaling/test_scaling_policy.py
+++ b/heat/tests/autoscaling/test_scaling_policy.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/aws/test_eip.py b/heat/tests/aws/test_eip.py
index 948002f18..4b6047d6c 100644
--- a/heat/tests/aws/test_eip.py
+++ b/heat/tests/aws/test_eip.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from neutronclient.common import exceptions as q_exceptions
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/aws/test_instance.py b/heat/tests/aws/test_instance.py
index 7445cabf8..500cb190d 100644
--- a/heat/tests/aws/test_instance.py
+++ b/heat/tests/aws/test_instance.py
@@ -12,9 +12,9 @@
# under the License.
import copy
+from unittest import mock
import uuid
-import mock
from neutronclient.v2_0 import client as neutronclient
from heat.common import exception
diff --git a/heat/tests/aws/test_loadbalancer.py b/heat/tests/aws/test_loadbalancer.py
index 07417d130..7ad6106a9 100644
--- a/heat/tests/aws/test_loadbalancer.py
+++ b/heat/tests/aws/test_loadbalancer.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/aws/test_s3.py b/heat/tests/aws/test_s3.py
index 229f36c4b..47882aa2c 100644
--- a/heat/tests/aws/test_s3.py
+++ b/heat/tests/aws/test_s3.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_config import cfg
import swiftclient.client as sc
diff --git a/heat/tests/aws/test_security_group.py b/heat/tests/aws/test_security_group.py
index 8c1b755e9..9f720caa9 100644
--- a/heat/tests/aws/test_security_group.py
+++ b/heat/tests/aws/test_security_group.py
@@ -13,8 +13,8 @@
import collections
import copy
+from unittest import mock
-import mock
from neutronclient.common import exceptions as neutron_exc
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/aws/test_user.py b/heat/tests/aws/test_user.py
index 8d6a89fac..410d2cff5 100644
--- a/heat/tests/aws/test_user.py
+++ b/heat/tests/aws/test_user.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/aws/test_volume.py b/heat/tests/aws/test_volume.py
index 54c72e4f4..a2dfbf91c 100644
--- a/heat/tests/aws/test_volume.py
+++ b/heat/tests/aws/test_volume.py
@@ -12,9 +12,9 @@
# under the License.
import copy
+from unittest import mock
from cinderclient import exceptions as cinder_exp
-import mock
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/aws/test_waitcondition.py b/heat/tests/aws/test_waitcondition.py
index a0a737fbf..5eff036b0 100644
--- a/heat/tests/aws/test_waitcondition.py
+++ b/heat/tests/aws/test_waitcondition.py
@@ -14,9 +14,9 @@
import copy
import datetime
import json
+from unittest import mock
import uuid
-import mock
from oslo_utils import timeutils
from urllib import parse
diff --git a/heat/tests/clients/test_barbican_client.py b/heat/tests/clients/test_barbican_client.py
index 977886710..6159ab70e 100644
--- a/heat/tests/clients/test_barbican_client.py
+++ b/heat/tests/clients/test_barbican_client.py
@@ -12,9 +12,9 @@
# under the License.
import collections
+from unittest import mock
from barbicanclient import exceptions
-import mock
from heat.common import exception
from heat.engine.clients.os import barbican
diff --git a/heat/tests/clients/test_blazar_client.py b/heat/tests/clients/test_blazar_client.py
index f9410f9fe..e671f862c 100644
--- a/heat/tests/clients/test_blazar_client.py
+++ b/heat/tests/clients/test_blazar_client.py
@@ -11,9 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from heat.tests import common
from heat.tests import utils
-import mock
class BlazarClientPluginTest(common.HeatTestCase):
diff --git a/heat/tests/clients/test_cinder_client.py b/heat/tests/clients/test_cinder_client.py
index bebfc574d..69b13c612 100644
--- a/heat/tests/clients/test_cinder_client.py
+++ b/heat/tests/clients/test_cinder_client.py
@@ -12,11 +12,11 @@
# under the License.
"""Tests for :module:'heat.engine.clients.os.cinder'."""
+from unittest import mock
import uuid
from cinderclient import exceptions as cinder_exc
from keystoneauth1 import exceptions as ks_exceptions
-import mock
from heat.common import exception
from heat.engine.clients.os import cinder
diff --git a/heat/tests/clients/test_clients.py b/heat/tests/clients/test_clients.py
index d30a4f4fb..c392c2a30 100644
--- a/heat/tests/clients/test_clients.py
+++ b/heat/tests/clients/test_clients.py
@@ -11,6 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from aodhclient import exceptions as aodh_exc
from cinderclient import exceptions as cinder_exc
from glanceclient import exc as glance_exc
@@ -20,7 +22,6 @@ from keystoneauth1 import exceptions as keystone_exc
from keystoneauth1.identity import generic
from manilaclient import exceptions as manila_exc
from mistralclient.api import base as mistral_base
-import mock
from neutronclient.common import exceptions as neutron_exc
from openstack import exceptions
from oslo_config import cfg
diff --git a/heat/tests/clients/test_designate_client.py b/heat/tests/clients/test_designate_client.py
index 03f74547f..5631565aa 100644
--- a/heat/tests/clients/test_designate_client.py
+++ b/heat/tests/clients/test_designate_client.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from designateclient import client as designate_client
-import mock
from heat.common import exception as heat_exception
from heat.engine.clients.os import designate as client
diff --git a/heat/tests/clients/test_glance_client.py b/heat/tests/clients/test_glance_client.py
index 738f471d8..4db8b1ead 100644
--- a/heat/tests/clients/test_glance_client.py
+++ b/heat/tests/clients/test_glance_client.py
@@ -11,10 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
from glanceclient import exc
-import mock
from heat.engine.clients import client_exception as exception
from heat.engine.clients.os import glance
diff --git a/heat/tests/clients/test_heat_client.py b/heat/tests/clients/test_heat_client.py
index c7d4d5cb8..912fbdf75 100644
--- a/heat/tests/clients/test_heat_client.py
+++ b/heat/tests/clients/test_heat_client.py
@@ -12,7 +12,7 @@
# under the License.
import json
-import mock
+from unittest import mock
import uuid
from keystoneauth1 import access as ks_access
diff --git a/heat/tests/clients/test_ironic_client.py b/heat/tests/clients/test_ironic_client.py
index a56ae3e1b..5b0568d57 100644
--- a/heat/tests/clients/test_ironic_client.py
+++ b/heat/tests/clients/test_ironic_client.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from ironicclient import exceptions as ic_exc
-import mock
from heat.engine.clients.os import ironic as ic
from heat.tests import common
diff --git a/heat/tests/clients/test_keystone_client.py b/heat/tests/clients/test_keystone_client.py
index 8536604fa..ddf041d58 100644
--- a/heat/tests/clients/test_keystone_client.py
+++ b/heat/tests/clients/test_keystone_client.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from keystoneauth1 import exceptions as keystone_exceptions
-import mock
from heat.common import exception
from heat.engine.clients.os import keystone
diff --git a/heat/tests/clients/test_magnum_client.py b/heat/tests/clients/test_magnum_client.py
index 97bf939ce..e0468308c 100644
--- a/heat/tests/clients/test_magnum_client.py
+++ b/heat/tests/clients/test_magnum_client.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from magnumclient import exceptions as mc_exc
-import mock
from heat.engine.clients.os import magnum as mc
from heat.tests import common
diff --git a/heat/tests/clients/test_manila_client.py b/heat/tests/clients/test_manila_client.py
index a1a986091..5ed2f7a2f 100644
--- a/heat/tests/clients/test_manila_client.py
+++ b/heat/tests/clients/test_manila_client.py
@@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
+from unittest import mock
from manilaclient import exceptions
-import mock
from heat.common import exception as heat_exception
from heat.tests import common
diff --git a/heat/tests/clients/test_mistral_client.py b/heat/tests/clients/test_mistral_client.py
index da3707ba1..b05475423 100644
--- a/heat/tests/clients/test_mistral_client.py
+++ b/heat/tests/clients/test_mistral_client.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from mistralclient.auth import keystone
-import mock
from heat.common import exception
from heat.engine.clients.os import mistral
diff --git a/heat/tests/clients/test_monasca_client.py b/heat/tests/clients/test_monasca_client.py
index 37214c693..b5d566d6f 100644
--- a/heat/tests/clients/test_monasca_client.py
+++ b/heat/tests/clients/test_monasca_client.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception as heat_exception
from heat.engine.clients.os import monasca as client_plugin
diff --git a/heat/tests/clients/test_neutron_client.py b/heat/tests/clients/test_neutron_client.py
index a8b8b9e62..bc470b79b 100644
--- a/heat/tests/clients/test_neutron_client.py
+++ b/heat/tests/clients/test_neutron_client.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.common import exceptions as qe
from heat.common import exception
diff --git a/heat/tests/clients/test_nova_client.py b/heat/tests/clients/test_nova_client.py
index 9bdba9a2a..35e37cc61 100644
--- a/heat/tests/clients/test_nova_client.py
+++ b/heat/tests/clients/test_nova_client.py
@@ -13,9 +13,9 @@
"""Tests for :module:'heat.engine.clients.os.nova'."""
import collections
+from unittest import mock
import uuid
-import mock
from novaclient import client as nc
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
diff --git a/heat/tests/clients/test_sahara_client.py b/heat/tests/clients/test_sahara_client.py
index 1cc97dd44..d0d0d3438 100644
--- a/heat/tests/clients/test_sahara_client.py
+++ b/heat/tests/clients/test_sahara_client.py
@@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
-import mock
from saharaclient.api import base as sahara_base
from heat.common import exception
diff --git a/heat/tests/clients/test_sdk_client.py b/heat/tests/clients/test_sdk_client.py
index 98f40af07..d2fd238f0 100644
--- a/heat/tests/clients/test_sdk_client.py
+++ b/heat/tests/clients/test_sdk_client.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from openstack import exceptions
diff --git a/heat/tests/clients/test_senlin_client.py b/heat/tests/clients/test_senlin_client.py
index 9510050d1..0e3bdf3d8 100644
--- a/heat/tests/clients/test_senlin_client.py
+++ b/heat/tests/clients/test_senlin_client.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from openstack import exceptions
from heat.engine.clients.os import senlin as senlin_plugin
diff --git a/heat/tests/clients/test_swift_client.py b/heat/tests/clients/test_swift_client.py
index 4b6d1060f..90272b6df 100644
--- a/heat/tests/clients/test_swift_client.py
+++ b/heat/tests/clients/test_swift_client.py
@@ -12,8 +12,8 @@
# under the License.
import datetime
+from unittest import mock
-import mock
import pytz
from testtools import matchers
diff --git a/heat/tests/clients/test_zaqar_client.py b/heat/tests/clients/test_zaqar_client.py
index ffd7b6aaa..bd588c7c9 100644
--- a/heat/tests/clients/test_zaqar_client.py
+++ b/heat/tests/clients/test_zaqar_client.py
@@ -11,10 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os import zaqar
-
from heat.tests import common
from heat.tests import utils
diff --git a/heat/tests/clients/test_zun_client.py b/heat/tests/clients/test_zun_client.py
index ae022a223..e20326597 100644
--- a/heat/tests/clients/test_zun_client.py
+++ b/heat/tests/clients/test_zun_client.py
@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.tests import common
from heat.tests import utils
diff --git a/heat/tests/constraints/test_common_constraints.py b/heat/tests/constraints/test_common_constraints.py
index 5d5c84aa5..7f993fada 100644
--- a/heat/tests/constraints/test_common_constraints.py
+++ b/heat/tests/constraints/test_common_constraints.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.constraint import common_constraints as cc
from heat.tests import common
diff --git a/heat/tests/convergence/framework/worker_wrapper.py b/heat/tests/convergence/framework/worker_wrapper.py
index 7ca39ada1..841cdb361 100644
--- a/heat/tests/convergence/framework/worker_wrapper.py
+++ b/heat/tests/convergence/framework/worker_wrapper.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine import worker
from heat.tests.convergence.framework import message_processor
diff --git a/heat/tests/db/test_sqlalchemy_api.py b/heat/tests/db/test_sqlalchemy_api.py
index 2b43cc806..d022188fe 100644
--- a/heat/tests/db/test_sqlalchemy_api.py
+++ b/heat/tests/db/test_sqlalchemy_api.py
@@ -13,20 +13,19 @@
import copy
import datetime
-import fixtures
import json
import logging
import time
+from unittest import mock
import uuid
-import mock
+import fixtures
from oslo_config import cfg
from oslo_db import exception as db_exception
from oslo_utils import timeutils
from sqlalchemy.orm import exc
from sqlalchemy.orm import session
-
from heat.common import context
from heat.common import exception
from heat.common import short_id
diff --git a/heat/tests/db/test_sqlalchemy_filters.py b/heat/tests/db/test_sqlalchemy_filters.py
index 93a9cb4a5..e3424aee7 100644
--- a/heat/tests/db/test_sqlalchemy_filters.py
+++ b/heat/tests/db/test_sqlalchemy_filters.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.db.sqlalchemy import filters as db_filters
from heat.tests import common
diff --git a/heat/tests/engine/service/test_service_engine.py b/heat/tests/engine/service/test_service_engine.py
index 421c2e359..cdda53097 100644
--- a/heat/tests/engine/service/test_service_engine.py
+++ b/heat/tests/engine/service/test_service_engine.py
@@ -12,8 +12,8 @@
# under the License.
import datetime
+from unittest import mock
-import mock
from oslo_config import cfg
from oslo_utils import timeutils
diff --git a/heat/tests/engine/service/test_software_config.py b/heat/tests/engine/service/test_software_config.py
index 83657adf3..ecd7bef62 100644
--- a/heat/tests/engine/service/test_software_config.py
+++ b/heat/tests/engine/service/test_software_config.py
@@ -12,9 +12,9 @@
# under the License.
import datetime
+from unittest import mock
import uuid
-import mock
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils as json
from oslo_utils import timeutils
diff --git a/heat/tests/engine/service/test_stack_action.py b/heat/tests/engine/service/test_stack_action.py
index ccec6bcac..48a704b67 100644
--- a/heat/tests/engine/service/test_stack_action.py
+++ b/heat/tests/engine/service/test_stack_action.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_messaging.rpc import dispatcher
from heat.common import exception
diff --git a/heat/tests/engine/service/test_stack_adopt.py b/heat/tests/engine/service/test_stack_adopt.py
index 4421b6d30..acdb6c253 100644
--- a/heat/tests/engine/service/test_stack_adopt.py
+++ b/heat/tests/engine/service/test_stack_adopt.py
@@ -11,7 +11,8 @@
# 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_messaging.rpc import dispatcher
diff --git a/heat/tests/engine/service/test_stack_create.py b/heat/tests/engine/service/test_stack_create.py
index 428540e5b..ad55a270f 100644
--- a/heat/tests/engine/service/test_stack_create.py
+++ b/heat/tests/engine/service/test_stack_create.py
@@ -11,7 +11,8 @@
# 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_messaging.rpc import dispatcher
from oslo_service import threadgroup
diff --git a/heat/tests/engine/service/test_stack_delete.py b/heat/tests/engine/service/test_stack_delete.py
index 8eb40f763..1b34ee61c 100644
--- a/heat/tests/engine/service/test_stack_delete.py
+++ b/heat/tests/engine/service/test_stack_delete.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 cfg
from oslo_messaging.rpc import dispatcher
from oslo_utils import timeutils
diff --git a/heat/tests/engine/service/test_stack_events.py b/heat/tests/engine/service/test_stack_events.py
index fa0e8e1d1..a1da41582 100644
--- a/heat/tests/engine/service/test_stack_events.py
+++ b/heat/tests/engine/service/test_stack_events.py
@@ -11,7 +11,8 @@
# 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_messaging import conffixture
diff --git a/heat/tests/engine/service/test_stack_resources.py b/heat/tests/engine/service/test_stack_resources.py
index c432a0cff..ce97bafab 100644
--- a/heat/tests/engine/service/test_stack_resources.py
+++ b/heat/tests/engine/service/test_stack_resources.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 cfg
from oslo_messaging.rpc import dispatcher
diff --git a/heat/tests/engine/service/test_stack_snapshot.py b/heat/tests/engine/service/test_stack_snapshot.py
index 058738e3d..79e8b05b9 100644
--- a/heat/tests/engine/service/test_stack_snapshot.py
+++ b/heat/tests/engine/service/test_stack_snapshot.py
@@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
-import mock
from oslo_messaging.rpc import dispatcher
from heat.common import exception
diff --git a/heat/tests/engine/service/test_stack_update.py b/heat/tests/engine/service/test_stack_update.py
index cf005b6bb..17aaabb8b 100644
--- a/heat/tests/engine/service/test_stack_update.py
+++ b/heat/tests/engine/service/test_stack_update.py
@@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
import eventlet.queue
-import mock
from oslo_config import cfg
from oslo_messaging import conffixture
from oslo_messaging.rpc import dispatcher
diff --git a/heat/tests/engine/service/test_threadgroup_mgr.py b/heat/tests/engine/service/test_threadgroup_mgr.py
index b66e96170..6df892e13 100644
--- a/heat/tests/engine/service/test_threadgroup_mgr.py
+++ b/heat/tests/engine/service/test_threadgroup_mgr.py
@@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-import eventlet
-import mock
+from unittest import mock
+import eventlet
from oslo_context import context
from heat.engine import service
diff --git a/heat/tests/engine/test_check_resource.py b/heat/tests/engine/test_check_resource.py
index 486c15ea7..b0544bacd 100644
--- a/heat/tests/engine/test_check_resource.py
+++ b/heat/tests/engine/test_check_resource.py
@@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import eventlet
-import mock
+from unittest import mock
import uuid
+import eventlet
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/engine/test_engine_worker.py b/heat/tests/engine/test_engine_worker.py
index bdde6c8be..0eed84fb0 100644
--- a/heat/tests/engine/test_engine_worker.py
+++ b/heat/tests/engine/test_engine_worker.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
from heat.db.sqlalchemy import api as db_api
from heat.engine import check_resource
diff --git a/heat/tests/engine/test_resource_type.py b/heat/tests/engine/test_resource_type.py
index db3023bc1..770a357ff 100644
--- a/heat/tests/engine/test_resource_type.py
+++ b/heat/tests/engine/test_resource_type.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine import environment
diff --git a/heat/tests/engine/test_scheduler.py b/heat/tests/engine/test_scheduler.py
index edb20f97c..112d810a1 100644
--- a/heat/tests/engine/test_scheduler.py
+++ b/heat/tests/engine/test_scheduler.py
@@ -13,9 +13,9 @@
import contextlib
import itertools
+from unittest import mock
import eventlet
-import mock
from heat.common import timeutils
from heat.engine import dependencies
diff --git a/heat/tests/engine/test_sync_point.py b/heat/tests/engine/test_sync_point.py
index cbe03d164..d424160c8 100644
--- a/heat/tests/engine/test_sync_point.py
+++ b/heat/tests/engine/test_sync_point.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
+
from oslo_db import exception
from heat.engine import sync_point
diff --git a/heat/tests/fakes.py b/heat/tests/fakes.py
index c157440a1..b2cb29df5 100644
--- a/heat/tests/fakes.py
+++ b/heat/tests/fakes.py
@@ -18,8 +18,9 @@ wrong the tests might raise AssertionError. I've indicated in comments the
places where actual behavior differs from the spec.
"""
+from unittest import mock
+
from keystoneauth1 import plugin
-import mock
class FakeClient(object):
diff --git a/heat/tests/openstack/aodh/test_alarm.py b/heat/tests/openstack/aodh/test_alarm.py
index 9197dd5a2..cb5b6fb53 100644
--- a/heat/tests/openstack/aodh/test_alarm.py
+++ b/heat/tests/openstack/aodh/test_alarm.py
@@ -14,8 +14,7 @@
import copy
import json
-
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/aodh/test_composite_alarm.py b/heat/tests/openstack/aodh/test_composite_alarm.py
index 6afdb9efb..1d43af681 100644
--- a/heat/tests/openstack/aodh/test_composite_alarm.py
+++ b/heat/tests/openstack/aodh/test_composite_alarm.py
@@ -12,8 +12,7 @@
# under the License.
import copy
-
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/aodh/test_gnocchi_alarm.py b/heat/tests/openstack/aodh/test_gnocchi_alarm.py
index 1d554efbe..2747b707b 100644
--- a/heat/tests/openstack/aodh/test_gnocchi_alarm.py
+++ b/heat/tests/openstack/aodh/test_gnocchi_alarm.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/barbican/test_container.py b/heat/tests/openstack/barbican/test_container.py
index 1bf7ef5df..1309dcede 100644
--- a/heat/tests/openstack/barbican/test_container.py
+++ b/heat/tests/openstack/barbican/test_container.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/barbican/test_order.py b/heat/tests/openstack/barbican/test_order.py
index 8cac6b72f..c464b3fa4 100644
--- a/heat/tests/openstack/barbican/test_order.py
+++ b/heat/tests/openstack/barbican/test_order.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/barbican/test_secret.py b/heat/tests/openstack/barbican/test_secret.py
index ffcea6f8f..673ef40da 100644
--- a/heat/tests/openstack/barbican/test_secret.py
+++ b/heat/tests/openstack/barbican/test_secret.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/blazar/test_host.py b/heat/tests/openstack/blazar/test_host.py
index ab3d750a9..6021b6a8c 100644
--- a/heat/tests/openstack/blazar/test_host.py
+++ b/heat/tests/openstack/blazar/test_host.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from blazarclient import exception as client_exception
-import mock
from oslo_utils.fixture import uuidsentinel as uuids
from heat.common import exception
diff --git a/heat/tests/openstack/blazar/test_lease.py b/heat/tests/openstack/blazar/test_lease.py
index 4991a14d2..00938e3a6 100644
--- a/heat/tests/openstack/blazar/test_lease.py
+++ b/heat/tests/openstack/blazar/test_lease.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from blazarclient import exception as client_exception
-import mock
from oslo_utils.fixture import uuidsentinel as uuids
from heat.common import exception
diff --git a/heat/tests/openstack/cinder/test_qos_specs.py b/heat/tests/openstack/cinder/test_qos_specs.py
index b77cd728f..fc5178aa5 100644
--- a/heat/tests/openstack/cinder/test_qos_specs.py
+++ b/heat/tests/openstack/cinder/test_qos_specs.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os import cinder as c_plugin
from heat.engine.resources.openstack.cinder import qos_specs
diff --git a/heat/tests/openstack/cinder/test_quota.py b/heat/tests/openstack/cinder/test_quota.py
index c1b1213ef..62312f284 100644
--- a/heat/tests/openstack/cinder/test_quota.py
+++ b/heat/tests/openstack/cinder/test_quota.py
@@ -10,7 +10,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 heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/cinder/test_volume.py b/heat/tests/openstack/cinder/test_volume.py
index 2d4e302b7..6a2cc5ea9 100644
--- a/heat/tests/openstack/cinder/test_volume.py
+++ b/heat/tests/openstack/cinder/test_volume.py
@@ -14,9 +14,9 @@
import collections
import copy
import json
+from unittest import mock
from cinderclient import exceptions as cinder_exp
-import mock
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/cinder/test_volume_type.py b/heat/tests/openstack/cinder/test_volume_type.py
index e8d904c51..de094fb24 100644
--- a/heat/tests/openstack/cinder/test_volume_type.py
+++ b/heat/tests/openstack/cinder/test_volume_type.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.clients.os import cinder as c_plugin
diff --git a/heat/tests/openstack/cinder/test_volume_type_encryption.py b/heat/tests/openstack/cinder/test_volume_type_encryption.py
index 08815b7bc..563c35aa4 100644
--- a/heat/tests/openstack/cinder/test_volume_type_encryption.py
+++ b/heat/tests/openstack/cinder/test_volume_type_encryption.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.clients.os import cinder as c_plugin
diff --git a/heat/tests/openstack/cinder/test_volume_utils.py b/heat/tests/openstack/cinder/test_volume_utils.py
index 376bb84dd..549d98058 100644
--- a/heat/tests/openstack/cinder/test_volume_utils.py
+++ b/heat/tests/openstack/cinder/test_volume_utils.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from cinderclient.v2 import client as cinderclient
-import mock
from heat.engine.clients.os import cinder
from heat.engine.clients.os import nova
diff --git a/heat/tests/openstack/designate/test_recordset.py b/heat/tests/openstack/designate/test_recordset.py
index c2166ed91..53d56fba3 100644
--- a/heat/tests/openstack/designate/test_recordset.py
+++ b/heat/tests/openstack/designate/test_recordset.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from designateclient import exceptions as designate_exception
-import mock
from heat.common import exception
from heat.engine.resources.openstack.designate import recordset
diff --git a/heat/tests/openstack/designate/test_zone.py b/heat/tests/openstack/designate/test_zone.py
index 8f5a0288c..7956ce13f 100644
--- a/heat/tests/openstack/designate/test_zone.py
+++ b/heat/tests/openstack/designate/test_zone.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.resources.openstack.designate import zone
diff --git a/heat/tests/openstack/glance/test_image.py b/heat/tests/openstack/glance/test_image.py
index 73f47a81a..62359d9e6 100644
--- a/heat/tests/openstack/glance/test_image.py
+++ b/heat/tests/openstack/glance/test_image.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from glanceclient import exc
from heat.common import exception
diff --git a/heat/tests/openstack/heat/test_cloud_config.py b/heat/tests/openstack/heat/test_cloud_config.py
index 9f740da5b..90fc7fbfe 100644
--- a/heat/tests/openstack/heat/test_cloud_config.py
+++ b/heat/tests/openstack/heat/test_cloud_config.py
@@ -11,10 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
import yaml
-import mock
from heat.engine import stack
from heat.engine import template
diff --git a/heat/tests/openstack/heat/test_deployed_server.py b/heat/tests/openstack/heat/test_deployed_server.py
index 86761e6b6..ba459c12b 100644
--- a/heat/tests/openstack/heat/test_deployed_server.py
+++ b/heat/tests/openstack/heat/test_deployed_server.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_serialization import jsonutils
from oslo_utils import uuidutils
diff --git a/heat/tests/openstack/heat/test_instance_group.py b/heat/tests/openstack/heat/test_instance_group.py
index 45e3b5c1c..92b1b580a 100644
--- a/heat/tests/openstack/heat/test_instance_group.py
+++ b/heat/tests/openstack/heat/test_instance_group.py
@@ -12,8 +12,7 @@
# under the License.
import copy
-
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import grouputils
diff --git a/heat/tests/openstack/heat/test_instance_group_update_policy.py b/heat/tests/openstack/heat/test_instance_group_update_policy.py
index 9ece3aa28..759b20e5e 100644
--- a/heat/tests/openstack/heat/test_instance_group_update_policy.py
+++ b/heat/tests/openstack/heat/test_instance_group_update_policy.py
@@ -12,8 +12,8 @@
# under the License.
import json
+from unittest import mock
-import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/heat/test_multi_part.py b/heat/tests/openstack/heat/test_multi_part.py
index 3d2b244c8..ad8d676c1 100644
--- a/heat/tests/openstack/heat/test_multi_part.py
+++ b/heat/tests/openstack/heat/test_multi_part.py
@@ -13,10 +13,9 @@
import contextlib
import email
+from unittest import mock
import uuid
-import mock
-
from heat.common import exception as exc
from heat.engine import stack as parser
from heat.engine import template
diff --git a/heat/tests/openstack/heat/test_none_resource.py b/heat/tests/openstack/heat/test_none_resource.py
index 13370ebaf..7344b36e5 100644
--- a/heat/tests/openstack/heat/test_none_resource.py
+++ b/heat/tests/openstack/heat/test_none_resource.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import template_format
from heat.engine import resource
diff --git a/heat/tests/openstack/heat/test_random_string.py b/heat/tests/openstack/heat/test_random_string.py
index 3eeb8c45c..6b36818ac 100644
--- a/heat/tests/openstack/heat/test_random_string.py
+++ b/heat/tests/openstack/heat/test_random_string.py
@@ -12,8 +12,8 @@
# under the License.
import re
+from unittest import mock
-import mock
from testtools import matchers
from heat.common import exception
diff --git a/heat/tests/openstack/heat/test_remote_stack.py b/heat/tests/openstack/heat/test_remote_stack.py
index 02768cf8c..b5df410a2 100644
--- a/heat/tests/openstack/heat/test_remote_stack.py
+++ b/heat/tests/openstack/heat/test_remote_stack.py
@@ -13,11 +13,11 @@
import collections
import json
+from unittest import mock
from heatclient import exc
from heatclient.v1 import stacks
from keystoneauth1 import loading as ks_loading
-import mock
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/heat/test_resource_chain.py b/heat/tests/openstack/heat/test_resource_chain.py
index 2ec1f5463..960c9ac3b 100644
--- a/heat/tests/openstack/heat/test_resource_chain.py
+++ b/heat/tests/openstack/heat/test_resource_chain.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine import node_data
diff --git a/heat/tests/openstack/heat/test_resource_group.py b/heat/tests/openstack/heat/test_resource_group.py
index bd39bc1ad..1355709ca 100644
--- a/heat/tests/openstack/heat/test_resource_group.py
+++ b/heat/tests/openstack/heat/test_resource_group.py
@@ -12,8 +12,7 @@
# under the License.
import copy
-
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import grouputils
diff --git a/heat/tests/openstack/heat/test_software_component.py b/heat/tests/openstack/heat/test_software_component.py
index 5e0842c40..feae76c36 100644
--- a/heat/tests/openstack/heat/test_software_component.py
+++ b/heat/tests/openstack/heat/test_software_component.py
@@ -12,7 +12,7 @@
# under the License.
import contextlib
-import mock
+from unittest import mock
from heat.common import exception as exc
from heat.common import template_format
diff --git a/heat/tests/openstack/heat/test_software_config.py b/heat/tests/openstack/heat/test_software_config.py
index 0ac5b643e..f194ec735 100644
--- a/heat/tests/openstack/heat/test_software_config.py
+++ b/heat/tests/openstack/heat/test_software_config.py
@@ -12,7 +12,7 @@
# under the License.
import contextlib
-import mock
+from unittest import mock
from heat.common import exception as exc
from heat.engine import stack
diff --git a/heat/tests/openstack/heat/test_software_deployment.py b/heat/tests/openstack/heat/test_software_deployment.py
index b6f4349ca..307ec572f 100644
--- a/heat/tests/openstack/heat/test_software_deployment.py
+++ b/heat/tests/openstack/heat/test_software_deployment.py
@@ -14,10 +14,9 @@
import contextlib
import copy
import re
+from unittest import mock
import uuid
-import mock
-
from oslo_serialization import jsonutils
from heat.common import exception as exc
diff --git a/heat/tests/openstack/heat/test_structured_config.py b/heat/tests/openstack/heat/test_structured_config.py
index ba389c19f..fa5c7511e 100644
--- a/heat/tests/openstack/heat/test_structured_config.py
+++ b/heat/tests/openstack/heat/test_structured_config.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.resources.openstack.heat import structured_config as sc
diff --git a/heat/tests/openstack/heat/test_swiftsignal.py b/heat/tests/openstack/heat/test_swiftsignal.py
index c910d315a..c3d2db0d6 100644
--- a/heat/tests/openstack/heat/test_swiftsignal.py
+++ b/heat/tests/openstack/heat/test_swiftsignal.py
@@ -13,9 +13,9 @@
import datetime
import json
+from unittest import mock
import uuid
-import mock
from oslo_utils import timeutils
from swiftclient import client as swiftclient_client
from swiftclient import exceptions as swiftclient_exceptions
diff --git a/heat/tests/openstack/heat/test_waitcondition.py b/heat/tests/openstack/heat/test_waitcondition.py
index 930598e7c..b3b17bb76 100644
--- a/heat/tests/openstack/heat/test_waitcondition.py
+++ b/heat/tests/openstack/heat/test_waitcondition.py
@@ -12,9 +12,9 @@
# under the License.
import datetime
+from unittest import mock
import uuid
-import mock
from oslo_serialization import jsonutils as json
from oslo_utils import timeutils
diff --git a/heat/tests/openstack/keystone/test_domain.py b/heat/tests/openstack/keystone/test_domain.py
index 1f6e45259..204b09205 100644
--- a/heat/tests/openstack/keystone/test_domain.py
+++ b/heat/tests/openstack/keystone/test_domain.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine import resource
diff --git a/heat/tests/openstack/keystone/test_endpoint.py b/heat/tests/openstack/keystone/test_endpoint.py
index 9bcc8b4c6..9a53476a1 100644
--- a/heat/tests/openstack/keystone/test_endpoint.py
+++ b/heat/tests/openstack/keystone/test_endpoint.py
@@ -12,8 +12,7 @@
# under the License.
import copy
-
-import mock
+from unittest import mock
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine import constraints
diff --git a/heat/tests/openstack/keystone/test_group.py b/heat/tests/openstack/keystone/test_group.py
index 680382030..01ecd9c93 100644
--- a/heat/tests/openstack/keystone/test_group.py
+++ b/heat/tests/openstack/keystone/test_group.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine import constraints
diff --git a/heat/tests/openstack/keystone/test_project.py b/heat/tests/openstack/keystone/test_project.py
index 9b3c4ef63..095251a29 100644
--- a/heat/tests/openstack/keystone/test_project.py
+++ b/heat/tests/openstack/keystone/test_project.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine import constraints
from heat.engine import properties
diff --git a/heat/tests/openstack/keystone/test_region.py b/heat/tests/openstack/keystone/test_region.py
index 0068c4ba2..bd3a3872f 100644
--- a/heat/tests/openstack/keystone/test_region.py
+++ b/heat/tests/openstack/keystone/test_region.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from urllib import parse
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
diff --git a/heat/tests/openstack/keystone/test_role.py b/heat/tests/openstack/keystone/test_role.py
index df9eda150..65fa0138a 100644
--- a/heat/tests/openstack/keystone/test_role.py
+++ b/heat/tests/openstack/keystone/test_role.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine import resource
diff --git a/heat/tests/openstack/keystone/test_role_assignments.py b/heat/tests/openstack/keystone/test_role_assignments.py
index a2f235866..116747778 100644
--- a/heat/tests/openstack/keystone/test_role_assignments.py
+++ b/heat/tests/openstack/keystone/test_role_assignments.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
diff --git a/heat/tests/openstack/keystone/test_service.py b/heat/tests/openstack/keystone/test_service.py
index ba2a7e0ad..2f773db2a 100644
--- a/heat/tests/openstack/keystone/test_service.py
+++ b/heat/tests/openstack/keystone/test_service.py
@@ -12,8 +12,7 @@
# under the License.
import copy
-
-import mock
+from unittest import mock
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine import properties
diff --git a/heat/tests/openstack/keystone/test_user.py b/heat/tests/openstack/keystone/test_user.py
index 7f67d5c34..6f7dda8f2 100644
--- a/heat/tests/openstack/keystone/test_user.py
+++ b/heat/tests/openstack/keystone/test_user.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os.keystone import fake_keystoneclient as fake_ks
from heat.engine import resource
diff --git a/heat/tests/openstack/magnum/test_bay.py b/heat/tests/openstack/magnum/test_bay.py
index f6102728c..66803e80e 100644
--- a/heat/tests/openstack/magnum/test_bay.py
+++ b/heat/tests/openstack/magnum/test_bay.py
@@ -12,7 +12,8 @@
# under the License.
import copy
-import mock
+from unittest import mock
+
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/magnum/test_cluster.py b/heat/tests/openstack/magnum/test_cluster.py
index c0c7be829..4bc58aecb 100644
--- a/heat/tests/openstack/magnum/test_cluster.py
+++ b/heat/tests/openstack/magnum/test_cluster.py
@@ -12,7 +12,8 @@
# under the License.
import copy
-import mock
+from unittest import mock
+
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/magnum/test_cluster_template.py b/heat/tests/openstack/magnum/test_cluster_template.py
index 7b1fc1e33..22d2aa31c 100644
--- a/heat/tests/openstack/magnum/test_cluster_template.py
+++ b/heat/tests/openstack/magnum/test_cluster_template.py
@@ -12,7 +12,8 @@
# under the License.
import copy
-import mock
+from unittest import mock
+
from neutronclient.neutron import v2_0 as neutronV20
from heat.common import exception
diff --git a/heat/tests/openstack/manila/test_security_service.py b/heat/tests/openstack/manila/test_security_service.py
index fe63d7823..7a4d17c00 100644
--- a/heat/tests/openstack/manila/test_security_service.py
+++ b/heat/tests/openstack/manila/test_security_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 heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/manila/test_share.py b/heat/tests/openstack/manila/test_share.py
index 08c7de679..9c23360a9 100644
--- a/heat/tests/openstack/manila/test_share.py
+++ b/heat/tests/openstack/manila/test_share.py
@@ -12,8 +12,7 @@
# under the License.
import collections
import copy
-
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/manila/test_share_network.py b/heat/tests/openstack/manila/test_share_network.py
index da723b35b..e550137b9 100644
--- a/heat/tests/openstack/manila/test_share_network.py
+++ b/heat/tests/openstack/manila/test_share_network.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/manila/test_share_type.py b/heat/tests/openstack/manila/test_share_type.py
index cf1032aad..08a79c040 100644
--- a/heat/tests/openstack/manila/test_share_type.py
+++ b/heat/tests/openstack/manila/test_share_type.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from heat.common import template_format
from heat.engine.resources.openstack.manila import share_type as mshare_type
diff --git a/heat/tests/openstack/mistral/test_cron_trigger.py b/heat/tests/openstack/mistral/test_cron_trigger.py
index 58c6a15d3..939452f61 100644
--- a/heat/tests/openstack/mistral/test_cron_trigger.py
+++ b/heat/tests/openstack/mistral/test_cron_trigger.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/mistral/test_external_resource.py b/heat/tests/openstack/mistral/test_external_resource.py
index 77032b817..fd92440a8 100644
--- a/heat/tests/openstack/mistral/test_external_resource.py
+++ b/heat/tests/openstack/mistral/test_external_resource.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/mistral/test_workflow.py b/heat/tests/openstack/mistral/test_workflow.py
index c311b5f56..9f0057dc9 100644
--- a/heat/tests/openstack/mistral/test_workflow.py
+++ b/heat/tests/openstack/mistral/test_workflow.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from mistralclient.api import base as mistral_base
diff --git a/heat/tests/openstack/monasca/test_alarm_definition.py b/heat/tests/openstack/monasca/test_alarm_definition.py
index f0ea7927c..8dba8d04d 100644
--- a/heat/tests/openstack/monasca/test_alarm_definition.py
+++ b/heat/tests/openstack/monasca/test_alarm_definition.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os import monasca as client_plugin
from heat.engine.resources.openstack.monasca import alarm_definition
diff --git a/heat/tests/openstack/monasca/test_notification.py b/heat/tests/openstack/monasca/test_notification.py
index 7f2b511ae..500597950 100644
--- a/heat/tests/openstack/monasca/test_notification.py
+++ b/heat/tests/openstack/monasca/test_notification.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.cfn import functions as cfn_funcs
diff --git a/heat/tests/openstack/neutron/lbaas/test_health_monitor.py b/heat/tests/openstack/neutron/lbaas/test_health_monitor.py
index bed3e2b45..4f0fd64a2 100644
--- a/heat/tests/openstack/neutron/lbaas/test_health_monitor.py
+++ b/heat/tests/openstack/neutron/lbaas/test_health_monitor.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/lbaas/test_l7policy.py b/heat/tests/openstack/neutron/lbaas/test_l7policy.py
index 95ab88779..e5b9de155 100644
--- a/heat/tests/openstack/neutron/lbaas/test_l7policy.py
+++ b/heat/tests/openstack/neutron/lbaas/test_l7policy.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/lbaas/test_l7rule.py b/heat/tests/openstack/neutron/lbaas/test_l7rule.py
index 258343ffc..b6103a966 100644
--- a/heat/tests/openstack/neutron/lbaas/test_l7rule.py
+++ b/heat/tests/openstack/neutron/lbaas/test_l7rule.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/lbaas/test_listener.py b/heat/tests/openstack/neutron/lbaas/test_listener.py
index 0b5887e8e..c7aa118fc 100644
--- a/heat/tests/openstack/neutron/lbaas/test_listener.py
+++ b/heat/tests/openstack/neutron/lbaas/test_listener.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/lbaas/test_loadbalancer.py b/heat/tests/openstack/neutron/lbaas/test_loadbalancer.py
index 24bb7047d..bc38d1aaf 100644
--- a/heat/tests/openstack/neutron/lbaas/test_loadbalancer.py
+++ b/heat/tests/openstack/neutron/lbaas/test_loadbalancer.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/lbaas/test_pool.py b/heat/tests/openstack/neutron/lbaas/test_pool.py
index b71c25bc8..debd5523f 100644
--- a/heat/tests/openstack/neutron/lbaas/test_pool.py
+++ b/heat/tests/openstack/neutron/lbaas/test_pool.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/lbaas/test_pool_member.py b/heat/tests/openstack/neutron/lbaas/test_pool_member.py
index d6c6c0af3..3138c2527 100644
--- a/heat/tests/openstack/neutron/lbaas/test_pool_member.py
+++ b/heat/tests/openstack/neutron/lbaas/test_pool_member.py
@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/test_address_scope.py b/heat/tests/openstack/neutron/test_address_scope.py
index 1473501c5..82d7df97c 100644
--- a/heat/tests/openstack/neutron/test_address_scope.py
+++ b/heat/tests/openstack/neutron/test_address_scope.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import template_format
from heat.engine.clients.os import neutron
diff --git a/heat/tests/openstack/neutron/test_extraroute.py b/heat/tests/openstack/neutron/test_extraroute.py
index 8ab5ac353..6ef33a0f2 100644
--- a/heat/tests/openstack/neutron/test_extraroute.py
+++ b/heat/tests/openstack/neutron/test_extraroute.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_firewall.py b/heat/tests/openstack/neutron/test_neutron_firewall.py
index ded9afdf1..b2b288bb9 100644
--- a/heat/tests/openstack/neutron/test_neutron_firewall.py
+++ b/heat/tests/openstack/neutron/test_neutron_firewall.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.common import exceptions
from neutronclient.v2_0 import client as neutronclient
from oslo_config import cfg
diff --git a/heat/tests/openstack/neutron/test_neutron_floating_ip.py b/heat/tests/openstack/neutron/test_neutron_floating_ip.py
index dc2ebac63..59f54147b 100644
--- a/heat/tests/openstack/neutron/test_neutron_floating_ip.py
+++ b/heat/tests/openstack/neutron/test_neutron_floating_ip.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from neutronclient.common import exceptions as qe
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_l2_gateway.py b/heat/tests/openstack/neutron/test_neutron_l2_gateway.py
index fc64584da..c711bc9d6 100644
--- a/heat/tests/openstack/neutron/test_neutron_l2_gateway.py
+++ b/heat/tests/openstack/neutron/test_neutron_l2_gateway.py
@@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.common import exceptions
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_l2_gateway_connection.py b/heat/tests/openstack/neutron/test_neutron_l2_gateway_connection.py
index b040281d3..6fecffd1b 100644
--- a/heat/tests/openstack/neutron/test_neutron_l2_gateway_connection.py
+++ b/heat/tests/openstack/neutron/test_neutron_l2_gateway_connection.py
@@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.v2_0 import client as neutronclient
from heat.common import template_format
diff --git a/heat/tests/openstack/neutron/test_neutron_loadbalancer.py b/heat/tests/openstack/neutron/test_neutron_loadbalancer.py
index 4670072f5..388c8056e 100644
--- a/heat/tests/openstack/neutron/test_neutron_loadbalancer.py
+++ b/heat/tests/openstack/neutron/test_neutron_loadbalancer.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.common import exceptions
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_metering.py b/heat/tests/openstack/neutron/test_neutron_metering.py
index 6363e50a6..256da1b81 100644
--- a/heat/tests/openstack/neutron/test_neutron_metering.py
+++ b/heat/tests/openstack/neutron/test_neutron_metering.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.common import exceptions
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_network_gateway.py b/heat/tests/openstack/neutron/test_neutron_network_gateway.py
index feea90afa..c88387850 100644
--- a/heat/tests/openstack/neutron/test_neutron_network_gateway.py
+++ b/heat/tests/openstack/neutron/test_neutron_network_gateway.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
from neutronclient.common import exceptions as qe
from neutronclient.neutron import v2_0 as neutronV20
diff --git a/heat/tests/openstack/neutron/test_neutron_port.py b/heat/tests/openstack/neutron/test_neutron_port.py
index 228273cde..4af5d54e1 100644
--- a/heat/tests/openstack/neutron/test_neutron_port.py
+++ b/heat/tests/openstack/neutron/test_neutron_port.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.common import exceptions as qe
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_provider_net.py b/heat/tests/openstack/neutron/test_neutron_provider_net.py
index 3d95714ed..a528c4d4d 100644
--- a/heat/tests/openstack/neutron/test_neutron_provider_net.py
+++ b/heat/tests/openstack/neutron/test_neutron_provider_net.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from neutronclient.common import exceptions as qe
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_rbac_policy.py b/heat/tests/openstack/neutron/test_neutron_rbac_policy.py
index 0ee21acf7..765a4caa1 100644
--- a/heat/tests/openstack/neutron/test_neutron_rbac_policy.py
+++ b/heat/tests/openstack/neutron/test_neutron_rbac_policy.py
@@ -12,7 +12,7 @@
# under the License.
-import mock
+from unittest import mock
import yaml
from neutronclient.common import exceptions
diff --git a/heat/tests/openstack/neutron/test_neutron_router.py b/heat/tests/openstack/neutron/test_neutron_router.py
index 19b1281ac..442668a2b 100644
--- a/heat/tests/openstack/neutron/test_neutron_router.py
+++ b/heat/tests/openstack/neutron/test_neutron_router.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from neutronclient.common import exceptions as qe
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_security_group.py b/heat/tests/openstack/neutron/test_neutron_security_group.py
index ea269aa22..28a931f51 100644
--- a/heat/tests/openstack/neutron/test_neutron_security_group.py
+++ b/heat/tests/openstack/neutron/test_neutron_security_group.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.common import exceptions as neutron_exc
from neutronclient.neutron import v2_0 as neutronV20
diff --git a/heat/tests/openstack/neutron/test_neutron_security_group_rule.py b/heat/tests/openstack/neutron/test_neutron_security_group_rule.py
index 407f5e9ce..49b427634 100644
--- a/heat/tests/openstack/neutron/test_neutron_security_group_rule.py
+++ b/heat/tests/openstack/neutron/test_neutron_security_group_rule.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/neutron/test_neutron_segment.py b/heat/tests/openstack/neutron/test_neutron_segment.py
index 4d5a1917b..fa00cf4c9 100644
--- a/heat/tests/openstack/neutron/test_neutron_segment.py
+++ b/heat/tests/openstack/neutron/test_neutron_segment.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from neutronclient.neutron import v2_0 as neutronV20
from openstack import exceptions
from oslo_utils import excutils
diff --git a/heat/tests/openstack/neutron/test_neutron_subnet.py b/heat/tests/openstack/neutron/test_neutron_subnet.py
index 1ce9209c4..a90e01230 100644
--- a/heat/tests/openstack/neutron/test_neutron_subnet.py
+++ b/heat/tests/openstack/neutron/test_neutron_subnet.py
@@ -12,7 +12,8 @@
# under the License.
import copy
-import mock
+from unittest import mock
+
from neutronclient.common import exceptions as qe
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/neutron/test_neutron_vpnservice.py b/heat/tests/openstack/neutron/test_neutron_vpnservice.py
index aa28c58f3..003d5bdd6 100644
--- a/heat/tests/openstack/neutron/test_neutron_vpnservice.py
+++ b/heat/tests/openstack/neutron/test_neutron_vpnservice.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from neutronclient.common import exceptions
from neutronclient.neutron import v2_0 as neutronV20
diff --git a/heat/tests/openstack/neutron/test_qos.py b/heat/tests/openstack/neutron/test_qos.py
index b490638f5..d46eb64f4 100644
--- a/heat/tests/openstack/neutron/test_qos.py
+++ b/heat/tests/openstack/neutron/test_qos.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import template_format
from heat.engine.clients.os import neutron
diff --git a/heat/tests/openstack/neutron/test_quota.py b/heat/tests/openstack/neutron/test_quota.py
index e2765ee03..4cf73ebfa 100644
--- a/heat/tests/openstack/neutron/test_quota.py
+++ b/heat/tests/openstack/neutron/test_quota.py
@@ -10,7 +10,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 heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/neutron/test_sfc/test_flow_classifier.py b/heat/tests/openstack/neutron/test_sfc/test_flow_classifier.py
index 5f5113c77..c4a0fd4e5 100644
--- a/heat/tests/openstack/neutron/test_sfc/test_flow_classifier.py
+++ b/heat/tests/openstack/neutron/test_sfc/test_flow_classifier.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.resources.openstack.neutron.sfc import flow_classifier
from heat.engine import stack
diff --git a/heat/tests/openstack/neutron/test_sfc/test_port_chain.py b/heat/tests/openstack/neutron/test_sfc/test_port_chain.py
index bfa073cba..233bb1549 100644
--- a/heat/tests/openstack/neutron/test_sfc/test_port_chain.py
+++ b/heat/tests/openstack/neutron/test_sfc/test_port_chain.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os import neutron
from heat.engine.resources.openstack.neutron.sfc import port_chain
diff --git a/heat/tests/openstack/neutron/test_sfc/test_port_pair.py b/heat/tests/openstack/neutron/test_sfc/test_port_pair.py
index 5bb9c7003..bb4fbf856 100644
--- a/heat/tests/openstack/neutron/test_sfc/test_port_pair.py
+++ b/heat/tests/openstack/neutron/test_sfc/test_port_pair.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.resources.openstack.neutron.sfc import port_pair
from heat.engine import stack
diff --git a/heat/tests/openstack/neutron/test_sfc/test_port_pair_group.py b/heat/tests/openstack/neutron/test_sfc/test_port_pair_group.py
index c1d73e228..0b150aec8 100644
--- a/heat/tests/openstack/neutron/test_sfc/test_port_pair_group.py
+++ b/heat/tests/openstack/neutron/test_sfc/test_port_pair_group.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os import neutron
from heat.engine.resources.openstack.neutron.sfc import port_pair_group
diff --git a/heat/tests/openstack/neutron/test_taas/test_tap_flow.py b/heat/tests/openstack/neutron/test_taas/test_tap_flow.py
index 7cf0095c4..ffff2fa59 100644
--- a/heat/tests/openstack/neutron/test_taas/test_tap_flow.py
+++ b/heat/tests/openstack/neutron/test_taas/test_tap_flow.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.resources.openstack.neutron.taas import tap_flow
from heat.engine import stack
diff --git a/heat/tests/openstack/neutron/test_taas/test_tap_service.py b/heat/tests/openstack/neutron/test_taas/test_tap_service.py
index 03fb3e5cf..322c910b6 100644
--- a/heat/tests/openstack/neutron/test_taas/test_tap_service.py
+++ b/heat/tests/openstack/neutron/test_taas/test_tap_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 heat.engine.resources.openstack.neutron.taas import tap_service
from heat.engine import stack
diff --git a/heat/tests/openstack/nova/fakes.py b/heat/tests/openstack/nova/fakes.py
index 17628a985..115a9910e 100644
--- a/heat/tests/openstack/nova/fakes.py
+++ b/heat/tests/openstack/nova/fakes.py
@@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
+
from novaclient import client as base_client
from novaclient import exceptions as nova_exceptions
import requests
@@ -22,7 +23,6 @@ from urllib import parse as urlparse
from heat.tests import fakes
-
NOVA_API_VERSION = "2.1"
Client = base_client.Client(NOVA_API_VERSION).__class__
diff --git a/heat/tests/openstack/nova/test_flavor.py b/heat/tests/openstack/nova/test_flavor.py
index 1f6afcfdf..ffb8334da 100644
--- a/heat/tests/openstack/nova/test_flavor.py
+++ b/heat/tests/openstack/nova/test_flavor.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine import stack
from heat.engine import template
diff --git a/heat/tests/openstack/nova/test_floatingip.py b/heat/tests/openstack/nova/test_floatingip.py
index afbdde024..e747ce224 100644
--- a/heat/tests/openstack/nova/test_floatingip.py
+++ b/heat/tests/openstack/nova/test_floatingip.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from neutronclient.v2_0 import client as neutronclient
from heat.common import exception as heat_ex
diff --git a/heat/tests/openstack/nova/test_host_aggregate.py b/heat/tests/openstack/nova/test_host_aggregate.py
index 676f5e5c4..bb0fbd944 100644
--- a/heat/tests/openstack/nova/test_host_aggregate.py
+++ b/heat/tests/openstack/nova/test_host_aggregate.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine.clients.os import nova
from heat.engine import stack
diff --git a/heat/tests/openstack/nova/test_keypair.py b/heat/tests/openstack/nova/test_keypair.py
index 4c2a3c7ec..c746b0950 100644
--- a/heat/tests/openstack/nova/test_keypair.py
+++ b/heat/tests/openstack/nova/test_keypair.py
@@ -12,8 +12,7 @@
# under the License.
import copy
-
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.clients.os import keystone
diff --git a/heat/tests/openstack/nova/test_quota.py b/heat/tests/openstack/nova/test_quota.py
index 2c275904e..bd2beb8f7 100644
--- a/heat/tests/openstack/nova/test_quota.py
+++ b/heat/tests/openstack/nova/test_quota.py
@@ -10,7 +10,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 heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/nova/test_server.py b/heat/tests/openstack/nova/test_server.py
index e90d5f4f9..6f841165d 100644
--- a/heat/tests/openstack/nova/test_server.py
+++ b/heat/tests/openstack/nova/test_server.py
@@ -14,7 +14,7 @@
import collections
import contextlib
import copy
-import mock
+from unittest import mock
from keystoneauth1 import exceptions as ks_exceptions
from neutronclient.v2_0 import client as neutronclient
diff --git a/heat/tests/openstack/nova/test_server_group.py b/heat/tests/openstack/nova/test_server_group.py
index 6a2e8bed5..0a1e682e0 100644
--- a/heat/tests/openstack/nova/test_server_group.py
+++ b/heat/tests/openstack/nova/test_server_group.py
@@ -12,8 +12,7 @@
# under the License.
import json
-
-import mock
+from unittest import mock
from heat.common import template_format
from heat.engine import scheduler
diff --git a/heat/tests/openstack/octavia/test_flavor.py b/heat/tests/openstack/octavia/test_flavor.py
index 556b9d31f..3d5b9537d 100644
--- a/heat/tests/openstack/octavia/test_flavor.py
+++ b/heat/tests/openstack/octavia/test_flavor.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import template_format
from heat.tests import common
diff --git a/heat/tests/openstack/octavia/test_flavor_profile.py b/heat/tests/openstack/octavia/test_flavor_profile.py
index 0452e9639..4c0646a33 100644
--- a/heat/tests/openstack/octavia/test_flavor_profile.py
+++ b/heat/tests/openstack/octavia/test_flavor_profile.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import template_format
from heat.tests import common
diff --git a/heat/tests/openstack/octavia/test_health_monitor.py b/heat/tests/openstack/octavia/test_health_monitor.py
index 880473881..bbc4c3e18 100644
--- a/heat/tests/openstack/octavia/test_health_monitor.py
+++ b/heat/tests/openstack/octavia/test_health_monitor.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_l7policy.py b/heat/tests/openstack/octavia/test_l7policy.py
index c66eff043..0628a94e5 100644
--- a/heat/tests/openstack/octavia/test_l7policy.py
+++ b/heat/tests/openstack/octavia/test_l7policy.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_l7rule.py b/heat/tests/openstack/octavia/test_l7rule.py
index 2d46d6fca..e5d1eb6b4 100644
--- a/heat/tests/openstack/octavia/test_l7rule.py
+++ b/heat/tests/openstack/octavia/test_l7rule.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_listener.py b/heat/tests/openstack/octavia/test_listener.py
index a126ec98a..bfafe29b1 100644
--- a/heat/tests/openstack/octavia/test_listener.py
+++ b/heat/tests/openstack/octavia/test_listener.py
@@ -12,7 +12,7 @@
# under the License.
-import mock
+from unittest import mock
import yaml
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_loadbalancer.py b/heat/tests/openstack/octavia/test_loadbalancer.py
index 56e527ab0..a93dda3f4 100644
--- a/heat/tests/openstack/octavia/test_loadbalancer.py
+++ b/heat/tests/openstack/octavia/test_loadbalancer.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.neutron import v2_0 as neutronV20
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_pool.py b/heat/tests/openstack/octavia/test_pool.py
index 34b3e31e8..1192d53d7 100644
--- a/heat/tests/openstack/octavia/test_pool.py
+++ b/heat/tests/openstack/octavia/test_pool.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_pool_member.py b/heat/tests/openstack/octavia/test_pool_member.py
index a75b3e808..07ce9f075 100644
--- a/heat/tests/openstack/octavia/test_pool_member.py
+++ b/heat/tests/openstack/octavia/test_pool_member.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from neutronclient.neutron import v2_0 as neutronV20
from osc_lib import exceptions
diff --git a/heat/tests/openstack/octavia/test_quota.py b/heat/tests/openstack/octavia/test_quota.py
index 5d440c88d..390ff3083 100644
--- a/heat/tests/openstack/octavia/test_quota.py
+++ b/heat/tests/openstack/octavia/test_quota.py
@@ -10,7 +10,8 @@
# 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
+
import six
from heat.common import exception
diff --git a/heat/tests/openstack/sahara/test_cluster.py b/heat/tests/openstack/sahara/test_cluster.py
index 221dbf630..d137984e9 100644
--- a/heat/tests/openstack/sahara/test_cluster.py
+++ b/heat/tests/openstack/sahara/test_cluster.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 oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/sahara/test_data_source.py b/heat/tests/openstack/sahara/test_data_source.py
index b563dbd9b..3417ee706 100644
--- a/heat/tests/openstack/sahara/test_data_source.py
+++ b/heat/tests/openstack/sahara/test_data_source.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 heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/sahara/test_image.py b/heat/tests/openstack/sahara/test_image.py
index 5da7a17eb..a7b00d896 100644
--- a/heat/tests/openstack/sahara/test_image.py
+++ b/heat/tests/openstack/sahara/test_image.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 heat.common import template_format
from heat.engine.clients.os import glance
diff --git a/heat/tests/openstack/sahara/test_job.py b/heat/tests/openstack/sahara/test_job.py
index 0566b8f45..4d8234b18 100644
--- a/heat/tests/openstack/sahara/test_job.py
+++ b/heat/tests/openstack/sahara/test_job.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 heat.common import template_format
from heat.engine.clients.os import sahara
diff --git a/heat/tests/openstack/sahara/test_job_binary.py b/heat/tests/openstack/sahara/test_job_binary.py
index 12d54d67a..ed9ba8142 100644
--- a/heat/tests/openstack/sahara/test_job_binary.py
+++ b/heat/tests/openstack/sahara/test_job_binary.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 heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/sahara/test_templates.py b/heat/tests/openstack/sahara/test_templates.py
index 2a43bde63..774e52fb7 100644
--- a/heat/tests/openstack/sahara/test_templates.py
+++ b/heat/tests/openstack/sahara/test_templates.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/senlin/test_cluster.py b/heat/tests/openstack/senlin/test_cluster.py
index 38a89c160..32b39fb54 100644
--- a/heat/tests/openstack/senlin/test_cluster.py
+++ b/heat/tests/openstack/senlin/test_cluster.py
@@ -14,7 +14,8 @@
# limitations under the License.
import copy
-import mock
+from unittest import mock
+
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/senlin/test_node.py b/heat/tests/openstack/senlin/test_node.py
index 9ba233d01..108d737ea 100644
--- a/heat/tests/openstack/senlin/test_node.py
+++ b/heat/tests/openstack/senlin/test_node.py
@@ -13,7 +13,8 @@
# limitations under the License.
import copy
-import mock
+from unittest import mock
+
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/openstack/senlin/test_policy.py b/heat/tests/openstack/senlin/test_policy.py
index 05e005313..5763cc561 100644
--- a/heat/tests/openstack/senlin/test_policy.py
+++ b/heat/tests/openstack/senlin/test_policy.py
@@ -13,7 +13,7 @@
# limitations under the License.
import copy
-import mock
+from unittest import mock
from openstack.clustering.v1._proxy import Proxy
from openstack import exceptions
diff --git a/heat/tests/openstack/senlin/test_profile.py b/heat/tests/openstack/senlin/test_profile.py
index 2a0001a9d..c3eb6b869 100644
--- a/heat/tests/openstack/senlin/test_profile.py
+++ b/heat/tests/openstack/senlin/test_profile.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
from heat.common import template_format
from heat.engine.clients.os import senlin
diff --git a/heat/tests/openstack/senlin/test_receiver.py b/heat/tests/openstack/senlin/test_receiver.py
index 138de4c6b..5685424b2 100644
--- a/heat/tests/openstack/senlin/test_receiver.py
+++ b/heat/tests/openstack/senlin/test_receiver.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 openstack import exceptions
diff --git a/heat/tests/openstack/swift/test_container.py b/heat/tests/openstack/swift/test_container.py
index deeb4dae3..82f05b13a 100644
--- a/heat/tests/openstack/swift/test_container.py
+++ b/heat/tests/openstack/swift/test_container.py
@@ -11,8 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
-import mock
import swiftclient.client as sc
from heat.common import exception
diff --git a/heat/tests/openstack/trove/test_cluster.py b/heat/tests/openstack/trove/test_cluster.py
index b3cb0b382..e2e32c1ed 100644
--- a/heat/tests/openstack/trove/test_cluster.py
+++ b/heat/tests/openstack/trove/test_cluster.py
@@ -12,7 +12,8 @@
# under the License.
import copy
-import mock
+from unittest import mock
+
from troveclient import exceptions as troveexc
from heat.common import exception
diff --git a/heat/tests/openstack/trove/test_instance.py b/heat/tests/openstack/trove/test_instance.py
index c1ac2aac2..bc4d024d2 100644
--- a/heat/tests/openstack/trove/test_instance.py
+++ b/heat/tests/openstack/trove/test_instance.py
@@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
-import mock
from oslo_config import cfg
from troveclient import exceptions as troveexc
from troveclient.v1 import users
diff --git a/heat/tests/openstack/zaqar/test_queue.py b/heat/tests/openstack/zaqar/test_queue.py
index e3c45e744..c12d1abbd 100644
--- a/heat/tests/openstack/zaqar/test_queue.py
+++ b/heat/tests/openstack/zaqar/test_queue.py
@@ -11,8 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
-
+from unittest import mock
from urllib import parse as urlparse
from heat.common import template_format
diff --git a/heat/tests/openstack/zaqar/test_subscription.py b/heat/tests/openstack/zaqar/test_subscription.py
index 214ce9bb3..436db0cab 100644
--- a/heat/tests/openstack/zaqar/test_subscription.py
+++ b/heat/tests/openstack/zaqar/test_subscription.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/openstack/zun/test_container.py b/heat/tests/openstack/zun/test_container.py
index 683a888c4..f69f995f1 100644
--- a/heat/tests/openstack/zun/test_container.py
+++ b/heat/tests/openstack/zun/test_container.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from oslo_config import cfg
from zunclient import exceptions as zc_exc
diff --git a/heat/tests/test_attributes.py b/heat/tests/test_attributes.py
index 182e0cdef..6ce5cafa1 100644
--- a/heat/tests/test_attributes.py
+++ b/heat/tests/test_attributes.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.engine import attributes
from heat.engine import resources
diff --git a/heat/tests/test_auth_password.py b/heat/tests/test_auth_password.py
index e1a207ab1..ee06d8b1e 100644
--- a/heat/tests/test_auth_password.py
+++ b/heat/tests/test_auth_password.py
@@ -14,8 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from unittest import mock
+
from keystoneauth1 import exceptions as keystone_exc
-import mock
from oslo_config import cfg
import webob
diff --git a/heat/tests/test_auth_url.py b/heat/tests/test_auth_url.py
index 8a00e48cc..585d5b7e8 100644
--- a/heat/tests/test_auth_url.py
+++ b/heat/tests/test_auth_url.py
@@ -14,7 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
+
import webob
from webob import exc
diff --git a/heat/tests/test_common_auth_plugin.py b/heat/tests/test_common_auth_plugin.py
index 3321c5ed1..ac289b3f1 100644
--- a/heat/tests/test_common_auth_plugin.py
+++ b/heat/tests/test_common_auth_plugin.py
@@ -12,9 +12,10 @@
# under the License.
import json
+from unittest import mock
+
from keystoneauth1 import loading as ks_loading
from keystoneauth1 import session
-import mock
from heat.common import auth_plugin
from heat.common import config
diff --git a/heat/tests/test_common_context.py b/heat/tests/test_common_context.py
index 405eaf869..01604c665 100644
--- a/heat/tests/test_common_context.py
+++ b/heat/tests/test_common_context.py
@@ -13,9 +13,9 @@
# under the License.
import os
+from unittest import mock
from keystoneauth1 import loading as ks_loading
-import mock
from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslo_middleware import request_id
diff --git a/heat/tests/test_convg_stack.py b/heat/tests/test_convg_stack.py
index 1d2476d0b..0db119781 100644
--- a/heat/tests/test_convg_stack.py
+++ b/heat/tests/test_convg_stack.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_config import cfg
from heat.common import template_format
diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py
index b1f5db6e8..d7d4ea6eb 100644
--- a/heat/tests/test_engine_api_utils.py
+++ b/heat/tests/test_engine_api_utils.py
@@ -13,9 +13,9 @@
import datetime as dt
import json
+from unittest import mock
import uuid
-import mock
from oslo_utils import timeutils
from heat.common import exception
diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py
index 40ddb9b11..aa6b62818 100644
--- a/heat/tests/test_engine_service.py
+++ b/heat/tests/test_engine_service.py
@@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
-import mock
from oslo_config import cfg
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils as json
diff --git a/heat/tests/test_environment.py b/heat/tests/test_environment.py
index 575d262e3..6de00dc9f 100644
--- a/heat/tests/test_environment.py
+++ b/heat/tests/test_environment.py
@@ -13,9 +13,9 @@
import os.path
import sys
+from unittest import mock
import fixtures
-import mock
from oslo_config import cfg
from heat.common import environment_format
diff --git a/heat/tests/test_environment_format.py b/heat/tests/test_environment_format.py
index facc5d3a3..55e1213e8 100644
--- a/heat/tests/test_environment_format.py
+++ b/heat/tests/test_environment_format.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import yaml
from heat.common import environment_format
diff --git a/heat/tests/test_event.py b/heat/tests/test_event.py
index 2035be4c9..8d9a2521b 100644
--- a/heat/tests/test_event.py
+++ b/heat/tests/test_event.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_config import cfg
import uuid
diff --git a/heat/tests/test_exception.py b/heat/tests/test_exception.py
index d36a3f6b5..eb2eb8ace 100644
--- a/heat/tests/test_exception.py
+++ b/heat/tests/test_exception.py
@@ -15,8 +15,9 @@
# under the License.
+from unittest import mock
+
import fixtures
-import mock
from heat.common import exception
from heat.common.i18n import _
diff --git a/heat/tests/test_grouputils.py b/heat/tests/test_grouputils.py
index 46908a613..32ac5de7c 100644
--- a/heat/tests/test_grouputils.py
+++ b/heat/tests/test_grouputils.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import grouputils
from heat.common import identifier
diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py
index 03a7054d6..6f0a0b495 100644
--- a/heat/tests/test_hot.py
+++ b/heat/tests/test_hot.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import identifier
diff --git a/heat/tests/test_lifecycle_plugin_utils.py b/heat/tests/test_lifecycle_plugin_utils.py
index 352922b4a..9d8f42bf4 100644
--- a/heat/tests/test_lifecycle_plugin_utils.py
+++ b/heat/tests/test_lifecycle_plugin_utils.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import lifecycle_plugin_utils
from heat.engine import lifecycle_plugin
diff --git a/heat/tests/test_loguserdata.py b/heat/tests/test_loguserdata.py
index 85802ebdb..7bb17002a 100644
--- a/heat/tests/test_loguserdata.py
+++ b/heat/tests/test_loguserdata.py
@@ -14,8 +14,8 @@
import errno
import os
import subprocess
+from unittest import mock
-import mock
from heat.cloudinit import loguserdata
from heat.tests import common
diff --git a/heat/tests/test_metadata_refresh.py b/heat/tests/test_metadata_refresh.py
index b638f3d36..da87ead4c 100644
--- a/heat/tests/test_metadata_refresh.py
+++ b/heat/tests/test_metadata_refresh.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_serialization import jsonutils
from heat.common import identifier
diff --git a/heat/tests/test_nested_stack.py b/heat/tests/test_nested_stack.py
index bd4f005d8..2fd71eecf 100644
--- a/heat/tests/test_nested_stack.py
+++ b/heat/tests/test_nested_stack.py
@@ -12,7 +12,8 @@
# under the License.
-import mock
+from unittest import mock
+
from oslo_config import cfg
from requests import exceptions
import yaml
diff --git a/heat/tests/test_notifications.py b/heat/tests/test_notifications.py
index f909774ff..e31575da7 100644
--- a/heat/tests/test_notifications.py
+++ b/heat/tests/test_notifications.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_utils import timeutils
from heat.common import timeutils as heat_timeutils
diff --git a/heat/tests/test_plugin_loader.py b/heat/tests/test_plugin_loader.py
index e8cbe9b62..681e7b2e9 100644
--- a/heat/tests/test_plugin_loader.py
+++ b/heat/tests/test_plugin_loader.py
@@ -14,8 +14,7 @@
import pkgutil
import sys
-
-import mock
+from unittest import mock
from heat.common import plugin_loader
import heat.engine
diff --git a/heat/tests/test_properties.py b/heat/tests/test_properties.py
index dfc148980..29647dcdd 100644
--- a/heat/tests/test_properties.py
+++ b/heat/tests/test_properties.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_serialization import jsonutils
from heat.common import exception
diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py
index dbfee4314..360a1c3e6 100644
--- a/heat/tests/test_provider_template.py
+++ b/heat/tests/test_provider_template.py
@@ -14,10 +14,9 @@
import collections
import json
import os
+from unittest import mock
import uuid
-import mock
-
from heat.common import exception
from heat.common.i18n import _
from heat.common import identifier
diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py
index 41cd56930..3adf5c428 100644
--- a/heat/tests/test_resource.py
+++ b/heat/tests/test_resource.py
@@ -13,14 +13,14 @@
import collections
import datetime
-import eventlet
import itertools
import json
import os
import sys
+from unittest import mock
import uuid
-import mock
+import eventlet
from oslo_config import cfg
from heat.common import exception
diff --git a/heat/tests/test_rpc_client.py b/heat/tests/test_rpc_client.py
index 7bf414216..a5fded812 100644
--- a/heat/tests/test_rpc_client.py
+++ b/heat/tests/test_rpc_client.py
@@ -18,8 +18,8 @@ Unit Tests for heat.rpc.client
"""
import copy
+from unittest import mock
-import mock
from oslo_messaging._drivers import common as rpc_common
from oslo_utils import reflection
diff --git a/heat/tests/test_rpc_listener_client.py b/heat/tests/test_rpc_listener_client.py
index fe10f3333..f753f9385 100644
--- a/heat/tests/test_rpc_listener_client.py
+++ b/heat/tests/test_rpc_listener_client.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
+
import oslo_messaging as messaging
from heat.rpc import api as rpc_api
diff --git a/heat/tests/test_rpc_worker_client.py b/heat/tests/test_rpc_worker_client.py
index 730e189a2..af1de7fb1 100644
--- a/heat/tests/test_rpc_worker_client.py
+++ b/heat/tests/test_rpc_worker_client.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+from unittest import mock
from heat.rpc import worker_api as rpc_api
from heat.rpc import worker_client as rpc_client
diff --git a/heat/tests/test_server_tags.py b/heat/tests/test_server_tags.py
index 2d484b160..d23102227 100644
--- a/heat/tests/test_server_tags.py
+++ b/heat/tests/test_server_tags.py
@@ -11,10 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
import uuid
-import mock
-
from heat.common import template_format
from heat.engine.clients.os import glance
from heat.engine.clients.os import nova
diff --git a/heat/tests/test_signal.py b/heat/tests/test_signal.py
index ff3470628..1025ef5fa 100644
--- a/heat/tests/test_signal.py
+++ b/heat/tests/test_signal.py
@@ -12,10 +12,10 @@
# under the License.
import datetime
+from unittest import mock
+from urllib import parse as urlparse
from keystoneauth1 import exceptions as kc_exceptions
-import mock
-from urllib import parse as urlparse
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/test_stack.py b/heat/tests/test_stack.py
index 2180491c5..0e8a0b4e4 100644
--- a/heat/tests/test_stack.py
+++ b/heat/tests/test_stack.py
@@ -17,10 +17,10 @@ import datetime
import json
import logging
import time
+from unittest import mock
import eventlet
import fixtures
-import mock
from oslo_config import cfg
from heat.common import context
diff --git a/heat/tests/test_stack_delete.py b/heat/tests/test_stack_delete.py
index 6b07ce0b2..51fb26a0c 100644
--- a/heat/tests/test_stack_delete.py
+++ b/heat/tests/test_stack_delete.py
@@ -13,10 +13,10 @@
import copy
import time
+from unittest import mock
import fixtures
from keystoneauth1 import exceptions as kc_exceptions
-import mock
from oslo_log import log as logging
from heat.common import exception
diff --git a/heat/tests/test_stack_lock.py b/heat/tests/test_stack_lock.py
index 272e689a0..7ea41c398 100644
--- a/heat/tests/test_stack_lock.py
+++ b/heat/tests/test_stack_lock.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
from heat.common import exception
from heat.common import service_utils
diff --git a/heat/tests/test_stack_resource.py b/heat/tests/test_stack_resource.py
index 3a305422c..f10f0a347 100644
--- a/heat/tests/test_stack_resource.py
+++ b/heat/tests/test_stack_resource.py
@@ -13,9 +13,9 @@
import contextlib
import json
+from unittest import mock
import uuid
-import mock
from oslo_config import cfg
from oslo_messaging import exceptions as msg_exceptions
from oslo_serialization import jsonutils
diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py
index 2fe3243c1..90a669881 100644
--- a/heat/tests/test_stack_update.py
+++ b/heat/tests/test_stack_update.py
@@ -12,8 +12,8 @@
# under the License.
import copy
+from unittest import mock
-import mock
from heat.common import exception
from heat.common import template_format
diff --git a/heat/tests/test_stack_user.py b/heat/tests/test_stack_user.py
index 82099118b..856fad220 100644
--- a/heat/tests/test_stack_user.py
+++ b/heat/tests/test_stack_user.py
@@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from unittest import mock
+
from keystoneauth1 import exceptions as kc_exceptions
-import mock
from heat.common import exception
from heat.common import short_id
diff --git a/heat/tests/test_template_format.py b/heat/tests/test_template_format.py
index 66e8d275c..3ce127c24 100644
--- a/heat/tests/test_template_format.py
+++ b/heat/tests/test_template_format.py
@@ -12,8 +12,8 @@
# under the License.
import os
+from unittest import mock
-import mock
import re
import yaml
diff --git a/heat/tests/test_translation_rule.py b/heat/tests/test_translation_rule.py
index d599ac550..efbc6d40d 100644
--- a/heat/tests/test_translation_rule.py
+++ b/heat/tests/test_translation_rule.py
@@ -12,7 +12,7 @@
# under the License.
import copy
-import mock
+from unittest import mock
from heat.common import exception
from heat.engine.cfn import functions as cfn_funcs
diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py
index febef0d4e..a5521e435 100644
--- a/heat/tests/test_validate.py
+++ b/heat/tests/test_validate.py
@@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
+
from oslo_messaging.rpc import dispatcher
import webob
diff --git a/heat/tests/test_vpc.py b/heat/tests/test_vpc.py
index 06eb4b1de..5db8f9660 100644
--- a/heat/tests/test_vpc.py
+++ b/heat/tests/test_vpc.py
@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import mock
+from unittest import mock
import uuid
from heat.common import exception
diff --git a/test-requirements.txt b/test-requirements.txt
index 9e9a488a4..a1965614d 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -8,7 +8,6 @@ bandit!=1.6.0,>=1.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
kombu!=4.0.2,>=4.0.0 # BSD
-mock>=2.0.0 # BSD
PyMySQL>=0.7.6 # MIT License
oslotest>=3.2.0 # Apache-2.0
psycopg2>=2.7 # LGPL/ZPL