diff --git a/lower-constraints.txt b/lower-constraints.txt index f9030fa30..19ef20186 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -30,7 +30,6 @@ jsonschema==2.6.0 keystoneauth1==3.4.0 linecache2==1.0.0 MarkupSafe==1.0 -mock==2.0.0 monotonic==0.6 msgpack-python==0.4.0 munch==2.1.0 @@ -85,3 +84,8 @@ unittest2==1.1.0 urllib3==1.21.1 warlock==1.2.0 wrapt==1.7.0 + +# Can be removed in Victoria cycle, when we raise the requirement of +# python-openstackclient in test-requirements to a version that no longer +# requires mock. See: https://review.opendev.org/#/c/717410/ +mock==2.0.0 diff --git a/manilaclient/tests/unit/common/test_httpclient.py b/manilaclient/tests/unit/common/test_httpclient.py index ccbb1943e..c03e2f472 100644 --- a/manilaclient/tests/unit/common/test_httpclient.py +++ b/manilaclient/tests/unit/common/test_httpclient.py @@ -10,9 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -import ddt -import mock import re +from unittest import mock + +import ddt import requests import manilaclient diff --git a/manilaclient/tests/unit/osc/osc_fakes.py b/manilaclient/tests/unit/osc/osc_fakes.py index 3e981dfa0..e37089948 100644 --- a/manilaclient/tests/unit/osc/osc_fakes.py +++ b/manilaclient/tests/unit/osc/osc_fakes.py @@ -13,11 +13,11 @@ # under the License. # -import mock -from oslo_serialization import jsonutils import sys +from unittest import mock from keystoneauth1 import fixture +from oslo_serialization import jsonutils import requests AUTH_TOKEN = "foobar" diff --git a/manilaclient/tests/unit/osc/v2/fakes.py b/manilaclient/tests/unit/osc/v2/fakes.py index 7eeb31dbe..e6bf2b5b0 100644 --- a/manilaclient/tests/unit/osc/v2/fakes.py +++ b/manilaclient/tests/unit/osc/v2/fakes.py @@ -13,8 +13,8 @@ import copy import datetime -import mock import random +from unittest import mock import uuid from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes diff --git a/manilaclient/tests/unit/osc/v2/test_share.py b/manilaclient/tests/unit/osc/v2/test_share.py index 94498974c..f3febde91 100644 --- a/manilaclient/tests/unit/osc/v2/test_share.py +++ b/manilaclient/tests/unit/osc/v2/test_share.py @@ -14,11 +14,9 @@ # import argparse -import mock +from unittest import mock import uuid -from mock import call - from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes from manilaclient.common import cliutils @@ -189,7 +187,7 @@ class TestShareDelete(TestShare): result = self.cmd.take_action(parsed_args) - calls = [call(s, None) for s in shares] + calls = [mock.call(s, None) for s in shares] self.shares_mock.delete.assert_has_calls(calls) self.assertIsNone(result) diff --git a/manilaclient/tests/unit/osc/v2/test_share_type.py b/manilaclient/tests/unit/osc/v2/test_share_type.py index 78cf8024f..ee9fd3641 100644 --- a/manilaclient/tests/unit/osc/v2/test_share_type.py +++ b/manilaclient/tests/unit/osc/v2/test_share_type.py @@ -11,7 +11,7 @@ # under the License. # -from mock import call +from unittest import mock from osc_lib import exceptions from osc_lib import utils as oscutils @@ -278,7 +278,7 @@ class TestShareTypeDelete(TestShareType): calls = [] for t in self.share_types: - calls.append(call(t)) + calls.append(mock.call(t)) self.shares_mock.delete.assert_has_calls(calls) self.assertIsNone(result) diff --git a/manilaclient/tests/unit/test_api_versions.py b/manilaclient/tests/unit/test_api_versions.py index b2f5f28e6..3e7d4ff3b 100644 --- a/manilaclient/tests/unit/test_api_versions.py +++ b/manilaclient/tests/unit/test_api_versions.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock import six import manilaclient diff --git a/manilaclient/tests/unit/test_base.py b/manilaclient/tests/unit/test_base.py index 2ec701c09..f833f9f09 100644 --- a/manilaclient/tests/unit/test_base.py +++ b/manilaclient/tests/unit/test_base.py @@ -9,7 +9,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 unittest import mock from manilaclient.common.apiclient import base as common_base from manilaclient import exceptions diff --git a/manilaclient/tests/unit/test_client.py b/manilaclient/tests/unit/test_client.py index a3cc778e9..9f5fbdacd 100644 --- a/manilaclient/tests/unit/test_client.py +++ b/manilaclient/tests/unit/test_client.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient import client diff --git a/manilaclient/tests/unit/test_shell.py b/manilaclient/tests/unit/test_shell.py index bc92f779c..6e3737b6f 100644 --- a/manilaclient/tests/unit/test_shell.py +++ b/manilaclient/tests/unit/test_shell.py @@ -12,10 +12,10 @@ import re import sys +from unittest import mock import ddt import fixtures -import mock from six import moves from tempest.lib.cli import output_parser from testtools import matchers diff --git a/manilaclient/tests/unit/utils.py b/manilaclient/tests/unit/utils.py index 3f8f0327d..48c92952c 100644 --- a/manilaclient/tests/unit/utils.py +++ b/manilaclient/tests/unit/utils.py @@ -11,9 +11,9 @@ # under the License. import os +from unittest import mock import fixtures -import mock import requests import testtools diff --git a/manilaclient/tests/unit/v2/test_availability_zones.py b/manilaclient/tests/unit/v2/test_availability_zones.py index b10470677..d82ea461e 100644 --- a/manilaclient/tests/unit/v2/test_availability_zones.py +++ b/manilaclient/tests/unit/v2/test_availability_zones.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_client.py b/manilaclient/tests/unit/v2/test_client.py index 1ed1091a7..03337315a 100644 --- a/manilaclient/tests/unit/v2/test_client.py +++ b/manilaclient/tests/unit/v2/test_client.py @@ -10,15 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock import ddt -import mock +from oslo_utils import uuidutils import manilaclient from manilaclient import exceptions from manilaclient.tests.unit import utils from manilaclient.v2 import client -from oslo_utils import uuidutils @ddt.ddt diff --git a/manilaclient/tests/unit/v2/test_limits.py b/manilaclient/tests/unit/v2/test_limits.py index d4265f7b5..f0e4ae3f4 100644 --- a/manilaclient/tests/unit/v2/test_limits.py +++ b/manilaclient/tests/unit/v2/test_limits.py @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + import ddt -import mock from manilaclient.tests.unit import utils from manilaclient.v2 import limits diff --git a/manilaclient/tests/unit/v2/test_messages.py b/manilaclient/tests/unit/v2/test_messages.py index 2477b1880..456a56e0c 100644 --- a/manilaclient/tests/unit/v2/test_messages.py +++ b/manilaclient/tests/unit/v2/test_messages.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import ddt import six diff --git a/manilaclient/tests/unit/v2/test_quota_classes.py b/manilaclient/tests/unit/v2/test_quota_classes.py index e5159b4fc..6fdff5170 100644 --- a/manilaclient/tests/unit/v2/test_quota_classes.py +++ b/manilaclient/tests/unit/v2/test_quota_classes.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_quotas.py b/manilaclient/tests/unit/v2/test_quotas.py index b7e2d40e1..273734dee 100644 --- a/manilaclient/tests/unit/v2/test_quotas.py +++ b/manilaclient/tests/unit/v2/test_quotas.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_scheduler_stats.py b/manilaclient/tests/unit/v2/test_scheduler_stats.py index 37c9a6fce..59c528a12 100644 --- a/manilaclient/tests/unit/v2/test_scheduler_stats.py +++ b/manilaclient/tests/unit/v2/test_scheduler_stats.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes diff --git a/manilaclient/tests/unit/v2/test_security_services.py b/manilaclient/tests/unit/v2/test_security_services.py index a6fa30399..58e7a75ab 100644 --- a/manilaclient/tests/unit/v2/test_security_services.py +++ b/manilaclient/tests/unit/v2/test_security_services.py @@ -12,7 +12,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 from manilaclient import exceptions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_services.py b/manilaclient/tests/unit/v2/test_services.py index 88b8f506a..ba64ae7ac 100644 --- a/manilaclient/tests/unit/v2/test_services.py +++ b/manilaclient/tests/unit/v2/test_services.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_share_export_locations.py b/manilaclient/tests/unit/v2/test_share_export_locations.py index 14be78993..aaf8f66b5 100644 --- a/manilaclient/tests/unit/v2/test_share_export_locations.py +++ b/manilaclient/tests/unit/v2/test_share_export_locations.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient import extension diff --git a/manilaclient/tests/unit/v2/test_share_group_snapshots.py b/manilaclient/tests/unit/v2/test_share_group_snapshots.py index 1351bda72..e396af200 100644 --- a/manilaclient/tests/unit/v2/test_share_group_snapshots.py +++ b/manilaclient/tests/unit/v2/test_share_group_snapshots.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import ddt import six diff --git a/manilaclient/tests/unit/v2/test_share_group_type_access.py b/manilaclient/tests/unit/v2/test_share_group_type_access.py index b09656cd3..1062ba28d 100644 --- a/manilaclient/tests/unit/v2/test_share_group_type_access.py +++ b/manilaclient/tests/unit/v2/test_share_group_type_access.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import ddt import six diff --git a/manilaclient/tests/unit/v2/test_share_group_types.py b/manilaclient/tests/unit/v2/test_share_group_types.py index 009b4f53f..beaaec3e8 100644 --- a/manilaclient/tests/unit/v2/test_share_group_types.py +++ b/manilaclient/tests/unit/v2/test_share_group_types.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import ddt import six diff --git a/manilaclient/tests/unit/v2/test_share_groups.py b/manilaclient/tests/unit/v2/test_share_groups.py index c4cd4a503..453e2a645 100644 --- a/manilaclient/tests/unit/v2/test_share_groups.py +++ b/manilaclient/tests/unit/v2/test_share_groups.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import ddt import six diff --git a/manilaclient/tests/unit/v2/test_share_instance_export_locations.py b/manilaclient/tests/unit/v2/test_share_instance_export_locations.py index 5bf8503a8..4fa955650 100644 --- a/manilaclient/tests/unit/v2/test_share_instance_export_locations.py +++ b/manilaclient/tests/unit/v2/test_share_instance_export_locations.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient import extension diff --git a/manilaclient/tests/unit/v2/test_share_instances.py b/manilaclient/tests/unit/v2/test_share_instances.py index 1e1ce99a1..a59f19d25 100644 --- a/manilaclient/tests/unit/v2/test_share_instances.py +++ b/manilaclient/tests/unit/v2/test_share_instances.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient import extension diff --git a/manilaclient/tests/unit/v2/test_share_network_subnets.py b/manilaclient/tests/unit/v2/test_share_network_subnets.py index dda6116f8..e0155a1d2 100644 --- a/manilaclient/tests/unit/v2/test_share_network_subnets.py +++ b/manilaclient/tests/unit/v2/test_share_network_subnets.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes diff --git a/manilaclient/tests/unit/v2/test_share_networks.py b/manilaclient/tests/unit/v2/test_share_networks.py index 7a8adad3d..3dde4ecb0 100644 --- a/manilaclient/tests/unit/v2/test_share_networks.py +++ b/manilaclient/tests/unit/v2/test_share_networks.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import ddt import itertools -import mock +from unittest import mock + +import ddt from manilaclient import api_versions from manilaclient import exceptions diff --git a/manilaclient/tests/unit/v2/test_share_replica_export_locations.py b/manilaclient/tests/unit/v2/test_share_replica_export_locations.py index c32bc173d..ff21dd70e 100644 --- a/manilaclient/tests/unit/v2/test_share_replica_export_locations.py +++ b/manilaclient/tests/unit/v2/test_share_replica_export_locations.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_share_replicas.py b/manilaclient/tests/unit/v2/test_share_replicas.py index 394bd33f4..7d91fa54e 100644 --- a/manilaclient/tests/unit/v2/test_share_replicas.py +++ b/manilaclient/tests/unit/v2/test_share_replicas.py @@ -12,8 +12,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_share_servers.py b/manilaclient/tests/unit/v2/test_share_servers.py index 88a1f0578..1e8af1b69 100644 --- a/manilaclient/tests/unit/v2/test_share_servers.py +++ b/manilaclient/tests/unit/v2/test_share_servers.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient.common.apiclient import base as common_base from manilaclient.common import constants diff --git a/manilaclient/tests/unit/v2/test_share_snapshot_instances.py b/manilaclient/tests/unit/v2/test_share_snapshot_instances.py index 24398fb97..1738c2e43 100644 --- a/manilaclient/tests/unit/v2/test_share_snapshot_instances.py +++ b/manilaclient/tests/unit/v2/test_share_snapshot_instances.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient import exceptions diff --git a/manilaclient/tests/unit/v2/test_share_snapshots.py b/manilaclient/tests/unit/v2/test_share_snapshots.py index 4ea067544..b118d992a 100644 --- a/manilaclient/tests/unit/v2/test_share_snapshots.py +++ b/manilaclient/tests/unit/v2/test_share_snapshots.py @@ -15,8 +15,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient import extension diff --git a/manilaclient/tests/unit/v2/test_shares.py b/manilaclient/tests/unit/v2/test_shares.py index 04921ed82..d606eb30d 100644 --- a/manilaclient/tests/unit/v2/test_shares.py +++ b/manilaclient/tests/unit/v2/test_shares.py @@ -15,8 +15,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.common.apiclient import exceptions as client_exceptions diff --git a/manilaclient/tests/unit/v2/test_shell.py b/manilaclient/tests/unit/v2/test_shell.py index ea06fd1d8..c92de6a33 100644 --- a/manilaclient/tests/unit/v2/test_shell.py +++ b/manilaclient/tests/unit/v2/test_shell.py @@ -15,10 +15,11 @@ # License for the specific language governing permissions and limitations # under the License. +import itertools +from unittest import mock + import ddt import fixtures -import itertools -import mock from oslo_utils import strutils import six diff --git a/manilaclient/tests/unit/v2/test_type_access.py b/manilaclient/tests/unit/v2/test_type_access.py index 40bbb59f4..50f0e8cec 100644 --- a/manilaclient/tests/unit/v2/test_type_access.py +++ b/manilaclient/tests/unit/v2/test_type_access.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from manilaclient import api_versions from manilaclient.tests.unit import utils diff --git a/manilaclient/tests/unit/v2/test_types.py b/manilaclient/tests/unit/v2/test_types.py index a4983d8ba..dfcd40184 100644 --- a/manilaclient/tests/unit/v2/test_types.py +++ b/manilaclient/tests/unit/v2/test_types.py @@ -12,9 +12,10 @@ # limitations under the License. import copy -import ddt import itertools -import mock +from unittest import mock + +import ddt from manilaclient import api_versions from manilaclient import config diff --git a/test-requirements.txt b/test-requirements.txt index 29b55c43e..d1d9c3f7c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,8 +8,12 @@ hacking>=3.0.1,<3.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT fixtures>=3.0.0 # Apache-2.0/BSD +# Can be removed in Victoria cycle, when we raise the requirement of +# python-openstackclient in this file to a version that no longer +# requires mock. See: https://review.opendev.org/717410/ mock>=2.0.0 # BSD os-testr>=1.0.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0 testtools>=2.2.0 # MIT python-openstackclient>=3.12.0 # Apache-2.0 +