Browse Source

Use unittest.mock instead of third party lib

mock was adopted into standard python
in version 3.3 [1]. Since manila no longer
supports python2.7, we can use the inbuilt
mock package rather than the third party
lib.

Fix some issues with imports that weren't
following our import conventions of grouping
imports [3]

Add a hacking test to ensure we don't regress
on this.

[1] https://docs.python.org/3/library/unittest.mock.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-March/013281.html
[3] https://docs.openstack.org/hacking/latest/user/hacking.html#imports

Co-Authored-By: Sean McGinnis <sean.mcginnis@gmail.com>
Change-Id: If857a49fbf526983e712282a25d7e8bef5093533
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
changes/24/720624/4
Goutham Pacha Ravi 2 years ago
parent
commit
598223985a
  1. 3
      HACKING.rst
  2. 1
      lower-constraints.txt
  3. 13
      manila/hacking/checks.py
  4. 2
      manila/test.py
  5. 6
      manila/tests/api/openstack/test_wsgi.py
  6. 3
      manila/tests/api/test_common.py
  7. 3
      manila/tests/api/test_extensions.py
  8. 3
      manila/tests/api/test_versions.py
  9. 3
      manila/tests/api/v1/test_scheduler_stats.py
  10. 3
      manila/tests/api/v1/test_security_service.py
  11. 3
      manila/tests/api/v1/test_share_manage.py
  12. 3
      manila/tests/api/v1/test_share_servers.py
  13. 3
      manila/tests/api/v1/test_share_snapshots.py
  14. 3
      manila/tests/api/v1/test_share_types_extra_specs.py
  15. 3
      manila/tests/api/v1/test_share_unmanage.py
  16. 2
      manila/tests/api/v1/test_shares.py
  17. 3
      manila/tests/api/v2/test_availability_zones.py
  18. 3
      manila/tests/api/v2/test_messages.py
  19. 2
      manila/tests/api/v2/test_quota_class_sets.py
  20. 3
      manila/tests/api/v2/test_quota_sets.py
  21. 3
      manila/tests/api/v2/test_security_services.py
  22. 2
      manila/tests/api/v2/test_services.py
  23. 3
      manila/tests/api/v2/test_share_access_metadata.py
  24. 3
      manila/tests/api/v2/test_share_accesses.py
  25. 3
      manila/tests/api/v2/test_share_export_locations.py
  26. 2
      manila/tests/api/v2/test_share_group_snapshots.py
  27. 3
      manila/tests/api/v2/test_share_group_type_specs.py
  28. 2
      manila/tests/api/v2/test_share_group_types.py
  29. 2
      manila/tests/api/v2/test_share_groups.py
  30. 3
      manila/tests/api/v2/test_share_instance_export_locations.py
  31. 3
      manila/tests/api/v2/test_share_instances.py
  32. 3
      manila/tests/api/v2/test_share_network_subnets.py
  33. 5
      manila/tests/api/v2/test_share_networks.py
  34. 3
      manila/tests/api/v2/test_share_replica_export_locations.py
  35. 3
      manila/tests/api/v2/test_share_replicas.py
  36. 3
      manila/tests/api/v2/test_share_servers.py
  37. 3
      manila/tests/api/v2/test_share_snapshot_export_locations.py
  38. 3
      manila/tests/api/v2/test_share_snapshot_instance_export_locations.py
  39. 3
      manila/tests/api/v2/test_share_snapshot_instances.py
  40. 3
      manila/tests/api/v2/test_share_snapshots.py
  41. 4
      manila/tests/api/v2/test_share_types.py
  42. 2
      manila/tests/api/v2/test_shares.py
  43. 3
      manila/tests/api/views/test_share_accesses.py
  44. 2
      manila/tests/api/views/test_versions.py
  45. 2
      manila/tests/cmd/test_manage.py
  46. 2
      manila/tests/cmd/test_share.py
  47. 4
      manila/tests/common/test_client_auth.py
  48. 3
      manila/tests/compute/test_nova.py
  49. 2
      manila/tests/data/test_helper.py
  50. 4
      manila/tests/data/test_manager.py
  51. 2
      manila/tests/data/test_rpcapi.py
  52. 3
      manila/tests/data/test_utils.py
  53. 3
      manila/tests/db/migrations/alembic/test_migration.py
  54. 4
      manila/tests/db/sqlalchemy/test_api.py
  55. 3
      manila/tests/db/test_migration.py
  56. 2
      manila/tests/fake_service_instance.py
  57. 2
      manila/tests/fake_utils.py
  58. 3
      manila/tests/message/test_api.py
  59. 3
      manila/tests/network/linux/test_interface.py
  60. 2
      manila/tests/network/linux/test_ip_lib.py
  61. 2
      manila/tests/network/linux/test_ovs_lib.py
  62. 3
      manila/tests/network/neutron/test_neutron_api.py
  63. 4
      manila/tests/network/neutron/test_neutron_plugin.py
  64. 3
      manila/tests/network/test_standalone_network_plugin.py
  65. 3
      manila/tests/scheduler/drivers/test_base.py
  66. 3
      manila/tests/scheduler/drivers/test_filter.py
  67. 3
      manila/tests/scheduler/drivers/test_simple.py
  68. 2
      manila/tests/scheduler/filters/test_base.py
  69. 3
      manila/tests/scheduler/test_host_manager.py
  70. 8
      manila/tests/scheduler/test_manager.py
  71. 2
      manila/tests/scheduler/test_rpcapi.py
  72. 3
      manila/tests/scheduler/weighers/test_capacity.py
  73. 2
      manila/tests/scheduler/weighers/test_host_affinity.py
  74. 3
      manila/tests/scheduler/weighers/test_pool.py
  75. 3
      manila/tests/share/drivers/cephfs/test_driver.py
  76. 5
      manila/tests/share/drivers/container/test_container_helper.py
  77. 5
      manila/tests/share/drivers/container/test_driver.py
  78. 5
      manila/tests/share/drivers/container/test_protocol_helper.py
  79. 6
      manila/tests/share/drivers/container/test_storage_helper.py
  80. 3
      manila/tests/share/drivers/dell_emc/common/enas/fakes.py
  81. 3
      manila/tests/share/drivers/dell_emc/common/enas/test_connector.py
  82. 5
      manila/tests/share/drivers/dell_emc/common/enas/test_utils.py
  83. 2
      manila/tests/share/drivers/dell_emc/common/enas/utils.py
  84. 3
      manila/tests/share/drivers/dell_emc/plugins/isilon/test_isilon.py
  85. 2
      manila/tests/share/drivers/dell_emc/plugins/powermax/test_connection.py
  86. 2
      manila/tests/share/drivers/dell_emc/plugins/powermax/test_object_manager.py
  87. 2
      manila/tests/share/drivers/dell_emc/plugins/unity/__init__.py
  88. 3
      manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py
  89. 3
      manila/tests/share/drivers/dell_emc/plugins/unity/test_client.py
  90. 3
      manila/tests/share/drivers/dell_emc/plugins/unity/test_connection.py
  91. 2
      manila/tests/share/drivers/dell_emc/plugins/unity/utils.py
  92. 2
      manila/tests/share/drivers/dell_emc/plugins/vnx/test_connection.py
  93. 3
      manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py
  94. 3
      manila/tests/share/drivers/dell_emc/test_driver.py
  95. 2
      manila/tests/share/drivers/ganesha/test_manager.py
  96. 2
      manila/tests/share/drivers/ganesha/test_utils.py
  97. 3
      manila/tests/share/drivers/glusterfs/test_common.py
  98. 3
      manila/tests/share/drivers/glusterfs/test_glusterfs_native.py
  99. 2
      manila/tests/share/drivers/glusterfs/test_layout.py
  100. 2
      manila/tests/share/drivers/glusterfs/test_layout_directory.py

3
HACKING.rst

@ -19,8 +19,9 @@ Manila Specific Commandments
- [M336] Must use a dict comprehension instead of a dict constructor
with a sequence of key-value pairs.
- [M337] Ensure to not use xrange().
- [M354] Use oslo_utils.uuidutils to generate UUID instead of uuid4().
- [M338] Ensure to not use LOG.warn().
- [M339] Ensure 'mock' is not imported/used. Use 'unittest.mock' instead.
- [M354] Use oslo_utils.uuidutils to generate UUID instead of uuid4().
- [M359] Validate that log messages are not translated.
LOG Translations

1
lower-constraints.txt

@ -46,7 +46,6 @@ lxml==3.4.1
Mako==1.0.7
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==1.4
mox3==0.25.0
msgpack==0.5.6

13
manila/hacking/checks.py

@ -53,6 +53,8 @@ dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)")
assert_no_xrange_re = re.compile(r"\s*xrange\s*\(")
assert_True = re.compile(r".*assertEqual\(True, .*\)")
no_log_warn = re.compile(r"\s*LOG.warn\(.*")
third_party_mock = re.compile(r"^import.mock")
from_third_party_mock = re.compile(r"^from.mock.import")
class BaseASTChecker(ast.NodeVisitor):
@ -333,3 +335,14 @@ def no_log_warn_check(logical_line):
msg = ("M338: LOG.warn is deprecated, use LOG.warning.")
if re.match(no_log_warn, logical_line):
yield(0, msg)
@core.flake8ext
def no_third_party_mock(logical_line):
# We should only use unittest.mock, not the third party mock library that
# was needed for py2 support.
if (re.match(third_party_mock, logical_line) or
re.match(from_third_party_mock, logical_line)):
msg = ('M339: Unit tests should use the standard library "mock" '
'module, not the third party mock library.')
yield(0, msg)

2
manila/test.py

@ -23,9 +23,9 @@ inline callbacks.
import os
import shutil
from unittest import mock
import fixtures
import mock
from oslo_concurrency import lockutils
from oslo_config import cfg
from oslo_config import fixture as config_fixture

6
manila/tests/api/openstack/test_wsgi.py

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import inspect
from unittest import mock
import ddt
import mock
import six
import webob
import inspect
from manila.api.openstack import api_version_request as api_version
from manila.api.openstack import wsgi
from manila import context

3
manila/tests/api/test_common.py

@ -17,8 +17,9 @@
Test suites for 'common' code used throughout the OpenStack HTTP API.
"""
from unittest import mock
import ddt
import mock
import webob
import webob.exc

3
manila/tests/api/test_extensions.py

@ -14,9 +14,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import ddt
import iso8601
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
import webob

3
manila/tests/api/test_versions.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 oslo_serialization import jsonutils
from oslo_utils import encodeutils

3
manila/tests/api/v1/test_scheduler_stats.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 oslo_utils import uuidutils
from webob import exc

3
manila/tests/api/v1/test_security_service.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 six.moves.urllib import parse
import webob

3
manila/tests/api/v1/test_share_manage.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
import webob
from manila.api import common

3
manila/tests/api/v1/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 webob import exc
from manila.api.openstack import api_version_request as api_version

3
manila/tests/api/v1/test_share_snapshots.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 oslo_serialization import jsonutils
import six
import webob

3
manila/tests/api/v1/test_share_types_extra_specs.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 oslo_utils import strutils
import webob

3
manila/tests/api/v1/test_share_unmanage.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
import webob
from manila.api.v1 import share_unmanage

2
manila/tests/api/v1/test_shares.py

@ -15,9 +15,9 @@
import copy
import datetime
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
import six

3
manila/tests/api/v2/test_availability_zones.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 manila.api.v2 import availability_zones
from manila import context

3
manila/tests/api/v2/test_messages.py

@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import datetime
import iso8601
import mock
from oslo_config import cfg
import webob

2
manila/tests/api/v2/test_quota_class_sets.py

@ -19,9 +19,9 @@ Tests for manila.api.v1.quota_class_sets.py
"""
import copy
from unittest import mock
import ddt
import mock
from oslo_config import cfg
import webob.exc
import webob.response

3
manila/tests/api/v2/test_quota_sets.py

@ -18,8 +18,9 @@
Tests for manila.api.v2.quota_sets.py
"""
from unittest import mock
import ddt
import mock
from oslo_config import cfg
import webob.exc
import webob.response

3
manila/tests/api/v2/test_security_services.py

@ -12,9 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import datetime
import ddt
import mock
from manila.api.v1 import security_service
from manila.common import constants

2
manila/tests/api/v2/test_services.py

@ -16,9 +16,9 @@
import datetime
from unittest import mock
import ddt
import mock
from oslo_utils import timeutils
from manila.api.v2 import services

3
manila/tests/api/v2/test_share_access_metadata.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
import webob
from manila.api.v2 import share_access_metadata

3
manila/tests/api/v2/test_share_accesses.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 webob import exc
from manila.api.v2 import share_accesses

3
manila/tests/api/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 webob import exc
from manila.api.openstack import api_version_request as api_version

2
manila/tests/api/v2/test_share_group_snapshots.py

@ -15,9 +15,9 @@
import copy
import datetime
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import uuidutils

3
manila/tests/api/v2/test_share_group_type_specs.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 oslo_utils import strutils
import webob

2
manila/tests/api/v2/test_share_group_types.py

@ -12,9 +12,9 @@
import copy
import datetime
from unittest import mock
import ddt
import mock
from oslo_config import cfg
import webob

2
manila/tests/api/v2/test_share_groups.py

@ -15,9 +15,9 @@
import copy
import datetime
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import uuidutils

3
manila/tests/api/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 webob import exc
from manila.api.v2 import share_instance_export_locations as export_locations

3
manila/tests/api/v2/test_share_instances.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 oslo_config import cfg
from oslo_serialization import jsonutils
import six

3
manila/tests/api/v2/test_share_network_subnets.py

@ -14,8 +14,9 @@
# under the License.
import copy
from unittest import mock
import ddt
import mock
from oslo_db import exception as db_exception
from manila.api import common

5
manila/tests/api/v2/test_share_networks.py

@ -14,14 +14,15 @@
# under the License.
import copy
from unittest import mock
import ddt
from manila.api import common
import mock
from oslo_db import exception as db_exception
from oslo_utils import timeutils
from six.moves.urllib import parse
from webob import exc as webob_exc
from manila.api import common
from manila.api.openstack import api_version_request as api_version
from manila.api.v2 import share_networks
from manila.db import api as db_api

3
manila/tests/api/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 webob import exc
from manila.api.v2 import share_replica_export_locations as export_locations

3
manila/tests/api/v2/test_share_replicas.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 oslo_config import cfg
from oslo_serialization import jsonutils
import six

3
manila/tests/api/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
import webob
from manila.api.v2 import share_servers

3
manila/tests/api/v2/test_share_snapshot_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 manila.api.v2 import share_snapshot_export_locations as export_locations
from manila.common import constants

3
manila/tests/api/v2/test_share_snapshot_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 manila.api.v2 import share_snapshot_instance_export_locations as exp_loc
from manila.common import constants

3
manila/tests/api/v2/test_share_snapshot_instances.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 oslo_config import cfg
from oslo_serialization import jsonutils
import six

3
manila/tests/api/v2/test_share_snapshots.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 oslo_serialization import jsonutils
import six
import webob

4
manila/tests/api/v2/test_share_types.py

@ -14,12 +14,12 @@
# under the License.
import datetime
import random
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from oslo_utils import timeutils
import random
import webob
from manila.api.v2 import share_types as types

2
manila/tests/api/v2/test_shares.py

@ -16,9 +16,9 @@
import copy
import datetime
import itertools
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import uuidutils

3
manila/tests/api/views/test_share_accesses.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 manila.api.openstack import api_version_request as api_version
from manila.api.views import share_accesses

2
manila/tests/api/views/test_versions.py

@ -14,9 +14,9 @@
# under the License.
import copy
from unittest import mock
import ddt
import mock
from manila.api.views import versions
from manila import test

2
manila/tests/cmd/test_manage.py

@ -16,9 +16,9 @@
import code
import readline
import sys
from unittest import mock
import ddt
import mock
from oslo_config import cfg
import six

2
manila/tests/cmd/test_share.py

@ -14,9 +14,9 @@
# under the License.
import sys
from unittest import mock
import ddt
import mock
from manila.cmd import share as manila_share
from manila import test

4
manila/tests/common/test_client_auth.py

@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from keystoneauth1 import loading as auth
from oslo_config import cfg
import mock
from manila.common import client_auth
from manila import exception
from manila import test

3
manila/tests/compute/test_nova.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 novaclient import exceptions as nova_exception
from novaclient import utils
from novaclient.v2 import servers as nova_servers

2
manila/tests/data/test_helper.py

@ -14,9 +14,9 @@
# under the License.
import os
from unittest import mock
import ddt
import mock
from manila.common import constants
from manila import context

4
manila/tests/data/test_manager.py

@ -15,8 +15,10 @@
"""
Tests For Data Manager
"""
from unittest import mock
import ddt
import mock
from manila.common import constants
from manila import context

2
manila/tests/data/test_rpcapi.py

@ -17,8 +17,8 @@ Unit Tests for manila.data.rpcapi
"""
import copy
from unittest import mock
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils

3
manila/tests/data/test_utils.py

@ -15,8 +15,7 @@
import os
import time
import mock
from unittest import mock
from manila.data import utils as data_utils
from manila import exception

3
manila/tests/db/migrations/alembic/test_migration.py

@ -17,8 +17,9 @@
Tests for database migrations.
"""
from unittest import mock
from alembic import script
import mock
from oslo_db.sqlalchemy import test_base
from oslo_db.sqlalchemy import test_migrations
from oslo_log import log

4
manila/tests/db/sqlalchemy/test_api.py

@ -19,10 +19,10 @@
import copy
import datetime
import ddt
import mock
import random
from unittest import mock
import ddt
from oslo_db import exception as db_exception
from oslo_utils import timeutils
from oslo_utils import uuidutils

3
manila/tests/db/test_migration.py

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import alembic
import mock
from manila.db import migration
from manila import test

2
manila/tests/fake_service_instance.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from manila.tests import fake_compute

2
manila/tests/fake_utils.py

@ -15,9 +15,9 @@
"""This modules stubs out functions in manila.utils."""
import re
from unittest import mock
from eventlet import greenthread
import mock
from oslo_log import log
import six

3
manila/tests/message/test_api.py

@ -9,9 +9,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.
import datetime
from unittest import mock
import mock
from oslo_config import cfg
from oslo_utils import timeutils

3
manila/tests/network/linux/test_interface.py

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

2
manila/tests/network/linux/test_ip_lib.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from manila.network.linux import ip_lib
from manila import test

2
manila/tests/network/linux/test_ovs_lib.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from manila.network.linux import ovs_lib
from manila import test

3
manila/tests/network/neutron/test_neutron_api.py

@ -14,7 +14,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 neutron_client_exc
from neutronclient.v2_0 import client as clientv20
from oslo_config import cfg

4
manila/tests/network/neutron/test_neutron_plugin.py

@ -15,10 +15,10 @@
# under the License.
import copy
import ddt
import mock
import time
from unittest import mock
import ddt
from oslo_config import cfg
from manila.common import constants

3
manila/tests/network/test_standalone_network_plugin.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
import netaddr
from oslo_config import cfg
import six

3
manila/tests/scheduler/drivers/test_base.py

@ -17,7 +17,8 @@
Tests For Base Scheduler
"""
import mock
from unittest import mock
from oslo_config import cfg
from oslo_utils import timeutils

3
manila/tests/scheduler/drivers/test_filter.py

@ -16,8 +16,9 @@
Tests For Filter Scheduler.
"""
from unittest import mock
import ddt
import mock
from oslo_utils import strutils
from manila.common import constants

3
manila/tests/scheduler/drivers/test_simple.py

@ -17,7 +17,8 @@
Tests For Simple Scheduler
"""
import mock
from unittest import mock
from oslo_config import cfg
from manila import context

2
manila/tests/scheduler/filters/test_base.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 manila.scheduler.filters import base
from manila import test

3
manila/tests/scheduler/test_host_manager.py

@ -19,8 +19,9 @@ Tests For HostManager
"""
import copy
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from oslo_utils import timeutils
from six import moves

8
manila/tests/scheduler/test_manager.py

@ -17,14 +17,10 @@
Tests For Scheduler Manager
"""
try:
# Python3 variant
from importlib import reload
except ImportError:
pass
from importlib import reload
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from manila.common import constants

2
manila/tests/scheduler/test_rpcapi.py

@ -17,8 +17,8 @@ Unit Tests for manila.scheduler.rpcapi
"""
import copy
from unittest import mock
import mock
from oslo_config import cfg
from manila import context

3
manila/tests/scheduler/weighers/test_capacity.py

@ -16,8 +16,9 @@
Tests For Capacity Weigher.
"""
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from manila import context

2
manila/tests/scheduler/weighers/test_host_affinity.py

@ -17,7 +17,7 @@
Tests for Host Affinity Weigher.
"""
import mock
from unittest import mock
from manila.common import constants
from manila.db import api as db_api

3
manila/tests/scheduler/weighers/test_pool.py

@ -16,7 +16,8 @@
Tests For Pool Weigher.
"""
import mock
from unittest import mock
from oslo_config import cfg
from oslo_utils import timeutils

3
manila/tests/share/drivers/cephfs/test_driver.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import ddt
import mock
from oslo_utils import units
from manila.common import constants
from manila import context
import manila.exception as exception

5
manila/tests/share/drivers/container/test_container_helper.py

@ -14,10 +14,11 @@
# under the License.
"""Unit tests for the Container helper module."""
import ddt
import mock
from unittest import mock
import uuid
import ddt
from manila import exception
from manila.share import configuration
from manila.share.drivers.container import container_helper

5
manila/tests/share/drivers/container/test_driver.py

@ -14,9 +14,10 @@
# under the License.
"""Unit tests for the Container driver module."""
import ddt
import functools
import mock
from unittest import mock
import ddt
from oslo_config import cfg
from manila.common import constants as const

5
manila/tests/share/drivers/container/test_protocol_helper.py

@ -14,9 +14,10 @@
# under the License.
"""Unit tests for the Protocol helper module."""
import ddt
import functools
import mock
from unittest import mock
import ddt
from manila.common import constants as const
from manila import exception

6
manila/tests/share/drivers/container/test_storage_helper.py

@ -13,9 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Unit tests for the Storage helper module."""
import ddt
import functools
import mock
from unittest import mock
import ddt
from manila import exception
from manila.share import configuration

3
manila/tests/share/drivers/dell_emc/common/enas/fakes.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_utils import units
from manila.common import constants as const

3
manila/tests/share/drivers/dell_emc/common/enas/test_connector.py

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from eventlet import greenthread
import mock
from oslo_concurrency import processutils
from six.moves.urllib import error as url_error
from six.moves.urllib import request as url_request

5
manila/tests/share/drivers/dell_emc/common/enas/test_utils.py

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import ddt
import mock
import ssl
from unittest import mock
import ddt
from manila.share.drivers.dell_emc.common.enas import utils
from manila import test

2
manila/tests/share/drivers/dell_emc/common/enas/utils.py

@ -14,9 +14,9 @@
# under the License.
import doctest
from unittest import mock
from lxml import doctestcompare
import mock
import six

3
manila/tests/share/drivers/dell_emc/plugins/isilon/test_isilon.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 oslo_log import log
from oslo_utils import units
from requests.exceptions import HTTPError

2
manila/tests/share/drivers/dell_emc/plugins/powermax/test_connection.py

@ -14,9 +14,9 @@
# under the License.
import copy
from unittest import mock
import ddt
import mock
from oslo_log import log
from manila import exception

2
manila/tests/share/drivers/dell_emc/plugins/powermax/test_object_manager.py

@ -14,10 +14,10 @@
# under the License.
import copy
from unittest import mock
import ddt
from lxml import builder
import mock
from oslo_concurrency import processutils
from manila import exception

2
manila/tests/share/drivers/dell_emc/plugins/unity/__init__.py

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import sys
from unittest import mock
sys.modules['storops'] = mock.Mock()
sys.modules['storops.unity'] = mock.Mock()

3
manila/tests/share/drivers/dell_emc/plugins/unity/res_mock.py

@ -13,7 +13,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

3
manila/tests/share/drivers/dell_emc/plugins/unity/test_client.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 oslo_utils import units
from manila import exception

3
manila/tests/share/drivers/dell_emc/plugins/unity/test_connection.py

@ -14,8 +14,9 @@
# under the License.
import copy
from unittest import mock
import ddt
import mock
from oslo_utils import units
import six

2
manila/tests/share/drivers/dell_emc/plugins/unity/utils.py

@ -14,9 +14,9 @@
# under the License.
from os import path
from unittest import mock
import yaml
import mock
from oslo_log import log
LOG = log.getLogger(__name__)

2
manila/tests/share/drivers/dell_emc/plugins/vnx/test_connection.py

@ -14,9 +14,9 @@
# under the License.
import copy
from unittest import mock
import ddt
import mock
from oslo_log import log
from manila import exception

3
manila/tests/share/drivers/dell_emc/plugins/vnx/test_object_manager.py

@ -15,10 +15,11 @@
import copy
import time
from unittest import mock
import ddt
from lxml import builder
import mock
from oslo_concurrency import processutils

3
manila/tests/share/drivers/dell_emc/test_driver.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from stevedore import extension
from manila.share import configuration as conf

2
manila/tests/share/drivers/ganesha/test_manager.py

@ -15,9 +15,9 @@
import copy
import re
from unittest import mock
import ddt
import mock