Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2 runtimes. Since we now only support py36 and later, we can use the standard lib unittest.mock module instead. Change-Id: I7b97fab683e45118327b93c776f8c487feab7374
This commit is contained in:
parent
4bf6c496bb
commit
4b654a840f
@ -56,7 +56,6 @@ lxml==3.4.1
|
||||
Mako==1.0.7
|
||||
MarkupSafe==1.0
|
||||
mccabe==0.4.0
|
||||
mock==2.0.0
|
||||
monotonic==1.4
|
||||
mox3==0.25.0
|
||||
msgpack==0.5.6
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from hashlib import md5
|
||||
from mock import MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
import json
|
||||
import os
|
||||
import socket
|
||||
|
@ -18,7 +18,7 @@ Tests dealing with HTTP rate-limiting.
|
||||
"""
|
||||
|
||||
|
||||
from mock import Mock, MagicMock, patch
|
||||
from unittest.mock import Mock, MagicMock, patch
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
from six.moves import http_client
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
import webob
|
||||
|
||||
from trove.common import cfg
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
|
||||
import datetime
|
||||
from mock import DEFAULT
|
||||
from mock import MagicMock
|
||||
from mock import patch
|
||||
from unittest.mock import DEFAULT
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import patch
|
||||
from swiftclient.client import ClientException
|
||||
|
||||
from trove.backup import models
|
||||
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import ANY
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import ANY
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove.cluster import models
|
||||
from trove.common.strategies.cluster.experimental.cassandra.api \
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from trove.cluster.models import Cluster
|
||||
from trove.cluster.models import ClusterTasks
|
||||
from trove.cluster.models import DBCluster
|
||||
|
@ -15,9 +15,9 @@
|
||||
#
|
||||
import jsonschema
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from testtools.matchers import Is, Equals
|
||||
from trove.cluster import models
|
||||
from trove.cluster.models import Cluster, DBCluster
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from trove.cluster import models
|
||||
from trove.common.strategies.cluster.experimental.mongodb.api import (
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
import jsonschema
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from testtools.matchers import Is, Equals
|
||||
from trove.cluster import models
|
||||
from trove.cluster.models import Cluster
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
import jsonschema
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from testtools.matchers import Is, Equals
|
||||
from trove.cluster import models
|
||||
from trove.cluster.models import Cluster
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
import jsonschema
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from testtools.matchers import Is, Equals
|
||||
from trove.cluster import models
|
||||
from trove.cluster.models import Cluster
|
||||
|
@ -14,9 +14,9 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove.cluster.views import ClusterInstanceDetailView
|
||||
from trove.cluster.views import ClusterView
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
|
||||
|
@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import ANY
|
||||
from mock import call
|
||||
from mock import DEFAULT
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from mock import PropertyMock
|
||||
from unittest.mock import ANY
|
||||
from unittest.mock import call
|
||||
from unittest.mock import DEFAULT
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import PropertyMock
|
||||
|
||||
from neutronclient.common import exceptions as neutron_exceptions
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
from trove.cluster.models import Cluster
|
||||
from trove.cluster.models import ClusterTasks
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
from trove.cluster.models import Cluster
|
||||
from trove.cluster.models import ClusterTasks
|
||||
|
@ -12,8 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from oslo_upgradecheck.upgradecheck import Code
|
||||
|
||||
from trove.cmd import status
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from testtools.matchers import Equals, Is
|
||||
from trove.common import context
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from trove.common import pagination
|
||||
from trove.tests.unittests import trove_testtools
|
||||
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import NonCallableMock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import NonCallableMock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove.common import exception as trove_exceptions
|
||||
from trove.common import policy as trove_policy
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
|
||||
import copy
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from trove.common import server_group as srv_grp
|
||||
from trove.tests.unittests import trove_testtools
|
||||
|
@ -11,7 +11,7 @@
|
||||
# limitations under the License.
|
||||
import re
|
||||
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
|
||||
from trove.common import template
|
||||
from trove.datastore.models import DatastoreVersion
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from testtools import ExpectedException
|
||||
from trove.common import exception
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
from testtools.matchers import Equals, Is, Not
|
||||
import webob.exc
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import patch
|
||||
from oslo_service import service as os_service
|
||||
|
||||
from trove.cmd import common as common_cmd
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from trove.backup import models as bkup_models
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
#
|
||||
import jsonschema
|
||||
from mock import MagicMock
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from trove.common import configurations
|
||||
from trove.common.exception import UnprocessableEntity
|
||||
|
@ -13,8 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove.common import exception
|
||||
from trove.datastore import models as datastore_models
|
||||
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from mock import call
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import call
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from sqlalchemy.engine import reflection
|
||||
from sqlalchemy.schema import Column
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import patch
|
||||
import six
|
||||
|
||||
from trove.common import exception
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from oslo_config.cfg import NoSuchOptError
|
||||
|
||||
from trove.common import exception
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
import uuid
|
||||
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from trove.common import exception
|
||||
from trove.datastore import models as datastore_models
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
from trove.flavor.views import FlavorView
|
||||
from trove.tests.unittests import trove_testtools
|
||||
|
||||
|
@ -14,10 +14,10 @@
|
||||
# under the License.
|
||||
#
|
||||
import copy
|
||||
from unittest.mock import Mock
|
||||
import uuid
|
||||
|
||||
import jsonschema
|
||||
from mock import Mock
|
||||
from testtools.matchers import Equals
|
||||
from testtools.matchers import Is
|
||||
from testtools.testcase import skip
|
||||
|
@ -11,8 +11,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.
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
import uuid
|
||||
|
||||
from trove.backup import models as backup_models
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from mock import Mock
|
||||
from unittest.mock import Mock
|
||||
from trove.common import cfg
|
||||
from trove.instance.views import InstanceDetailView
|
||||
from trove.instance.views import InstanceView
|
||||
|
@ -11,7 +11,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from trove.common import exception
|
||||
from trove.extensions.mgmt.clusters.models import MgmtCluster
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import jsonschema
|
||||
|
||||
from mock import Mock, patch, MagicMock, PropertyMock
|
||||
from unittest.mock import Mock, patch, MagicMock, PropertyMock
|
||||
from testtools.matchers import Is, Equals
|
||||
|
||||
from trove.common import clients
|
||||
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
from glanceclient import exc as glance_exceptions
|
||||
|
||||
from trove.common import clients
|
||||
|
@ -18,9 +18,9 @@ from testtools.matchers import Is
|
||||
from testtools.matchers import Not
|
||||
import uuid
|
||||
|
||||
from mock import ANY
|
||||
from mock import MagicMock
|
||||
from mock import patch
|
||||
from unittest.mock import ANY
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import patch
|
||||
from novaclient.client import Client
|
||||
from novaclient.v2.flavors import Flavor
|
||||
from novaclient.v2.flavors import FlavorManager
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
|
||||
import copy
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from trove.common import crypto_utils
|
||||
from trove.common import exception
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from mock import Mock, patch
|
||||
from unittest.mock import Mock, patch
|
||||
from trove.datastore import models
|
||||
from trove.module.views import DetailedModuleView
|
||||
from trove.tests.unittests import trove_testtools
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import Mock, MagicMock, patch
|
||||
from unittest.mock import Mock, MagicMock, patch
|
||||
from testtools import skipIf
|
||||
|
||||
from trove.common import cfg
|
||||
|
@ -14,8 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from unittest import mock
|
||||
|
||||
from trove.common import context
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove.cluster.models import ClusterTasks as ClusterTaskStatus
|
||||
from trove.cluster.models import DBCluster
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove.cluster.models import ClusterTasks as ClusterTaskStatus
|
||||
from trove.cluster.models import DBCluster
|
||||
|
@ -14,7 +14,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mock import MagicMock, Mock, patch, PropertyMock
|
||||
from unittest.mock import MagicMock, Mock, patch, PropertyMock
|
||||
from proboscis.asserts import assert_equal
|
||||
|
||||
from trove.backup.models import Backup
|
||||
|
@ -18,11 +18,11 @@ from unittest import mock
|
||||
from cinderclient import exceptions as cinder_exceptions
|
||||
from cinderclient.v2 import volumes as cinderclient_volumes
|
||||
import cinderclient.v2.client as cinderclient
|
||||
from mock import call
|
||||
from mock import MagicMock
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from mock import PropertyMock
|
||||
from unittest.mock import call
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import PropertyMock
|
||||
import neutronclient.v2_0.client as neutronclient
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
import novaclient.v2.flavors
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from mock import Mock
|
||||
from mock import patch
|
||||
from unittest.mock import Mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from trove import rpc
|
||||
from trove.cluster.models import ClusterTasks as ClusterTaskStatus
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
#
|
||||
import jsonschema
|
||||
from mock import Mock, MagicMock, patch
|
||||
from unittest.mock import Mock, MagicMock, patch
|
||||
|
||||
from trove.extensions.mgmt.upgrade.models import UpgradeMessageSender
|
||||
from trove.extensions.mgmt.upgrade.service import UpgradeController
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
from trove.extensions.mgmt.upgrade.models import UpgradeMessageSender
|
||||
from trove import rpc
|
||||
from trove.tests.unittests import trove_testtools
|
||||
|
Loading…
Reference in New Issue
Block a user