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>
This commit is contained in:
Sean McGinnis 2020-04-18 11:52:52 -05:00 committed by ricolin
parent 1067288b75
commit 4f41250223
234 changed files with 530 additions and 200 deletions

View File

@ -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):

View File

@ -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 _

View File

@ -13,7 +13,7 @@
import json
import mock
from unittest import mock
from oslo_config import cfg
from oslo_utils import importutils

View File

@ -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

View File

@ -12,8 +12,13 @@
# under the License.
import json
from unittest import mock
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
import webob.exc
import heat.api.middleware.fault as fault

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
import heat.api.middleware.fault as fault
import heat.api.openstack.v1.build_info as build_info

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
import webob.exc
import heat.api.middleware.fault as fault

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
import webob.exc
import heat.api.middleware.fault as fault

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -12,8 +12,8 @@
# under the License.
import json
from unittest import mock
import mock
from oslo_config import cfg
import webob.exc

View File

@ -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

View File

@ -11,8 +11,14 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
from urllib import parse as urlparse
=======
from unittest import mock
from six.moves.urllib import parse as urlparse
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.api.openstack.v1.views import views_common
from heat.tests import common

View File

@ -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

View File

@ -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

View File

@ -15,14 +15,19 @@
# under the License.
from unittest import mock
import fixtures
import json
<<<<<<< HEAD
import mock
=======
from oslo_config import cfg
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
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

View File

@ -12,8 +12,8 @@
import datetime
import json
from unittest import mock
import mock
from oslo_utils import timeutils
from heat.common import exception

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import short_id

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -13,8 +13,8 @@
import datetime
import json
from unittest import mock
import mock
from oslo_utils import timeutils
from heat.common import exception

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,9 +11,14 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from oslo_config import cfg
import six
import swiftclient.client as sc
from heat.common import exception

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -12,7 +12,7 @@
# under the License.
import json
import mock
from unittest import mock
import uuid
from keystoneauth1 import access as ks_access

View File

@ -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

View File

@ -11,8 +11,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from keystoneauth1 import exceptions as keystone_exceptions
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.engine.clients.os import keystone

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception as heat_exception
from heat.engine.clients.os import monasca as client_plugin

View File

@ -11,7 +11,14 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from neutronclient.common import exceptions as qe
from heat.common import exception

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -12,8 +12,8 @@
# under the License.
import datetime
from unittest import mock
import mock
import pytz
from testtools import matchers

View File

@ -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

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.tests import common
from heat.tests import utils

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.engine.constraint import common_constraints as cc
from heat.tests import common

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.engine import environment

View File

@ -12,10 +12,15 @@
# under the License.
import contextlib
import itertools
from unittest import mock
import eventlet
<<<<<<< HEAD
import mock
=======
import itertools
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import timeutils
from heat.engine import dependencies

View File

@ -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

View File

@ -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):

View File

@ -14,8 +14,13 @@
import copy
import json
from unittest import mock
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -12,8 +12,13 @@
# under the License.
import copy
from unittest import mock
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -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

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -10,7 +10,13 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import template_format

View File

@ -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

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.engine.clients.os import cinder as c_plugin

View File

@ -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

View File

@ -11,8 +11,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from cinderclient.v2 import client as cinderclient
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.engine.clients.os import cinder
from heat.engine.clients.os import nova

View File

@ -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

View File

@ -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

View File

@ -11,7 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from glanceclient import exc
from heat.common import exception

View File

@ -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

View File

@ -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

View File

@ -12,8 +12,13 @@
# under the License.
import copy
from unittest import mock
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import grouputils

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -12,8 +12,13 @@
# under the License.
import re
from unittest import mock
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from testtools import matchers
from heat.common import exception

View File

@ -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

View File

@ -12,7 +12,13 @@
# under the License.
import copy
<<<<<<< HEAD
import mock
=======
from unittest import mock
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.engine import node_data

View File

@ -12,8 +12,13 @@
# under the License.
import copy
from unittest import mock
<<<<<<< HEAD
import mock
=======
import six
>>>>>>> f9b47ffef... Use unittest.mock instead of third party mock
from heat.common import exception
from heat.common import grouputils

Some files were not shown because too many files have changed in this diff Show More