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: Ic07c0f6fa0b23242eb884cc34ac9d963b3030b17
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-04-18 12:00:13 -05:00 committed by Luigi Toscano
parent c33675508c
commit 551f58b978
91 changed files with 115 additions and 91 deletions

View File

@ -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 oslotest import base
from sahara import context

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
import sys
guestfs = mock.Mock()

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 sahara.cli import sahara_all
from sahara.cli import sahara_api

View File

@ -14,8 +14,8 @@
# limitations under the License.
import copy
from unittest import mock
import mock
from sqlalchemy import exc as sa_exc
import testtools

View File

@ -15,8 +15,8 @@
import copy
import datetime
from unittest import mock
import mock
from sqlalchemy import exc as sa_exc
import testtools

View File

@ -14,8 +14,8 @@
# limitations under the License.
import copy
from unittest import mock
import mock
from oslo_utils import uuidutils
import six
from sqlalchemy import exc as sa_ex

View File

@ -14,8 +14,8 @@
# under the License.
import sys
from unittest import mock
import mock
import testscenarios
import testtools

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import sqlalchemy as sa
import testtools
from unittest import mock
from sahara.db.sqlalchemy import types

View File

@ -14,9 +14,9 @@
import copy
import tempfile
from unittest import mock
import jsonschema
import mock
from oslo_serialization import jsonutils as json
from oslo_utils import uuidutils

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import context
from sahara.db.sqlalchemy import api

View File

@ -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_utils import uuidutils
import yaml

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from sahara import context
from sahara.plugins import kerberos as krb

View File

@ -12,8 +12,8 @@
# limitations under the License.
import jsonschema.exceptions as json_exc
import mock
import testtools
from unittest import mock
from sahara import conductor as cond
from sahara import context

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import six
from sahara import conductor as cond

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 sahara.plugins import exceptions as ex
from sahara.plugins import utils as pu

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import oslo_messaging
import six
import testtools

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import oslo_messaging
import six
import testtools

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 sahara.service.api.v2 import images
from sahara.tests.unit import base

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 sahara.service.edp.binary_retrievers import dispatch
from sahara.tests.unit import base

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
import sahara.exceptions as ex
from sahara.service.castellan import config as castellan

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
import sahara.service.edp.binary_retrievers.manila_share as ms
from sahara.tests.unit import base

View File

@ -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_utils import uuidutils
from sahara.service.edp.data_sources.base import DataSourceType

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
import sahara.exceptions as ex
from sahara.service.edp.data_sources.hdfs.implementation import HDFSType

View File

@ -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_utils import uuidutils
import testtools

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
import sahara.exceptions as ex
from sahara.service.edp.data_sources.s3.implementation import S3Type

View File

@ -14,8 +14,8 @@
# limitations under the License.
import copy
from unittest import mock
import mock
from oslo_utils import uuidutils
import testtools

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
from sahara import conductor as cond

View File

@ -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_utils import uuidutils
import testtools

View File

@ -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_utils import uuidutils
import testtools

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import exceptions as ex
from sahara.service.edp.job_binaries.s3.implementation import S3Type

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
import sahara.exceptions as ex
from sahara.service.castellan import config as castellan

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 sahara.service.edp.job_binaries import base as jb_base
from sahara.tests.unit import base

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 sahara import context as ctx
from sahara.plugins import base as pb

View File

@ -15,8 +15,8 @@
# limitations under the License.
import os
from unittest import mock
import mock
import sahara.exceptions as ex
from sahara.service.edp.job_utils import ds_manager

View File

@ -14,8 +14,8 @@
# limitations under the License.
import os
from unittest import mock
import mock
import sahara.exceptions as ex
from sahara.service.edp.job_utils import ds_manager

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 sahara.plugins import exceptions as ex
from sahara.service.edp import hdfs_helper as helper

View File

@ -14,9 +14,9 @@
# limitations under the License.
import copy
from unittest import mock
import xml.dom.minidom as xml
import mock
import testtools
from sahara import conductor as cond

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
import testtools

View File

@ -14,8 +14,8 @@
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import exceptions as ex
from sahara.service.edp import s3_common

View File

@ -18,7 +18,8 @@ try:
from manilaclient.common.apiclient import exceptions as manila_ex
except ImportError:
from manilaclient.openstack.common.apiclient import exceptions as manila_ex
import mock
from unittest import mock
from oslo_utils import uuidutils
import testtools

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import six
import testtools

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 sahara.conductor import resource as r
from sahara.service.heat import templates as h

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 sahara.service import coordinator
from sahara.tests.unit import base

View File

@ -15,7 +15,7 @@
from heatclient import exc as heat_exc
import mock
from unittest import mock
from sahara.service import engine
from sahara.service.heat import heat_engine

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 sahara.service import networks
from sahara.tests.unit import base

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 sahara.service import ntp_service as ntp
from sahara.tests.unit import base as test_base

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 sahara.plugins import base as base_plugins
from sahara.service import ops

View File

@ -14,8 +14,8 @@
# limitations under the License.
import datetime
from unittest import mock
import mock
from oslo_utils import timeutils
from sahara.conductor import manager

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
import testtools

View File

@ -13,8 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest import mock
from keystoneauth1 import session as keystone
import mock
from sahara import exceptions as ex
from sahara.service import sessions

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 sahara.service import trusts
from sahara.tests.unit import base

View File

@ -13,9 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest import mock
from cinderclient.v2 import volumes as vol_v2
from cinderclient.v3 import volumes as vol_v3
import mock
from sahara import exceptions as ex
from sahara.service import volumes

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
import testtools

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 sahara import exceptions as ex
from sahara.service.validations.edp import job as j

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 sahara.service.api import v10 as api
from sahara.service.validations.edp import job_binary as b

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 sahara.service.api import v10 as api
from sahara.service.validations.edp import job_binary_internal as jb

View File

@ -14,8 +14,8 @@
# limitations under the License.
import time
from unittest import mock
import mock
from oslo_utils import timeutils
from oslo_utils import uuidutils
import testtools

View File

@ -15,8 +15,8 @@
import collections
import itertools
from unittest import mock
import mock
from sahara.service.validations.edp import job as j
from sahara.service.validations.edp import job_execution_schema as j_e_schema

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import six
import testtools

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import exceptions as ex
from sahara.service import validation as v

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import six
import testtools

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
from sahara.service.api import v10 as api

View File

@ -14,8 +14,8 @@
# limitations under the License.
import copy
from unittest import mock
import mock
from sahara.service.api import v10 as api
from sahara.service.validations import cluster_template_schema as ct_schema

View File

@ -14,8 +14,8 @@
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import exceptions as ex
from sahara.service.api import v10 as api

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 sahara.service.api import v10 as api
from sahara.service.validations import node_group_template_schema as ngt_schema

View File

@ -17,7 +17,7 @@ try:
from manilaclient.common.apiclient import exceptions as manila_ex
except ImportError:
from manilaclient.openstack.common.apiclient import exceptions as manila_ex
import mock
from unittest import mock
from sahara.service.validations import shares
from sahara.tests.unit.service.validation import utils as u

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 sahara import exceptions
from sahara.service import validation

View File

@ -15,8 +15,8 @@
import ast
import re
from unittest import mock
import mock
from neutronclient.common import exceptions as neutron_ex
import novaclient.exceptions as nova_ex
import six

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 sahara.swift import swift_helper as h
from sahara.tests.unit import base

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 sahara.swift import utils
from sahara.tests.unit import base as testbase

View File

@ -14,9 +14,9 @@
# limitations under the License.
import random
from unittest import mock
import fixtures
import mock
import six
import testtools

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import context
from sahara import main

View File

@ -14,8 +14,8 @@
# limitations under the License.
import tempfile
from unittest import mock
import mock
from sahara.conductor import objects as o
from sahara import context

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 sahara import context
from sahara.tests.unit import base

View File

@ -14,10 +14,11 @@
# limitations under the License.
from unittest import mock
from cinderclient import exceptions as cinder_exc
from heatclient import exc as heat_exc
from keystoneauth1 import exceptions as keystone_exc
import mock
from neutronclient.common import exceptions as neutron_exc
from novaclient import exceptions as nova_exc

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara.utils.openstack import heat as heat_u

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 sahara.tests.unit import base
from sahara.utils.openstack import images as sahara_images

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 sahara.tests.unit import base as testbase
from sahara.utils.openstack import swift

View File

@ -14,8 +14,8 @@
# limitations under the License.
import copy
from unittest import mock
import mock
import testtools
from sahara.utils import api

View File

@ -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_exceptions
import mock
from oslo_config import cfg
from sahara import main

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 sahara import conductor
from sahara import context

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
from sahara import conductor

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara.utils import edp

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 sahara.tests.unit import base
from sahara.utils import general

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
import testtools
from unittest import mock
from sahara import exceptions as ex
from sahara.utils.openstack import heat as h

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 sahara.tests.unit import base
from sahara.utils.openstack import neutron as neutron_client

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import six
import testtools

View File

@ -14,7 +14,8 @@
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
from sahara.service.edp import job_utils

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 sahara import main
from sahara.tests.unit import base

View File

@ -15,8 +15,8 @@
import shlex
from unittest import mock
import mock
import testtools
from sahara import exceptions as ex

View File

@ -10,7 +10,6 @@ bashate>=0.5.1 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
oslotest>=3.2.0 # Apache-2.0
stestr>=1.0.0 # Apache-2.0
psycopg2>=2.7.3 # LGPL/ZPL