Browse Source

Introduce flake8-import-order extension

This adds usage of the flake8-import-order extension to our flake8
checks to enforce consistency on our import ordering to follow the
overall OpenStack code guidelines.

Since we have now dropped Python 2, this also cleans up a few cases for
things that were third party libs but became part of the standard
library such as mock, which is now a standard part of unittest.

Some questions, in order of importance:

Q: Are you insane?
A: Potentially.

Q: Why should we touch all of these files?
A: This adds consistency to our imports. The extension makes sure that
   all imports follow our published guidelines of having imports ordered
   by standard lib, third party, and local. This will be a one time
   churn, then we can ensure consistency over time.

Q: Why bother. this doesn't really matter?
A: I agree - but...

We have the issue that we have less people actively involved and less
time to perform thorough code reviews. This will make it objective and
automated to catch these kinds of issues.

But part of this, even though it maybe seems a little annoying, is for
making it easier for contributors. Right now, we may or may not notice
if something is following the guidelines or not. And we may or may not
comment in a review to ask for a contributor to make adjustments to
follow the guidelines.

But then further along into the review process, someone decides to be
thorough, and after the contributor feels like they've had to deal with
other change requests and things are in really good shape, they get a -1
on something mostly meaningless as far as the functionality of their
code. It can be a frustrating and disheartening thing.

I believe this actually helps avoid that by making it an objective thing
that they find out right away up front - either the code is following
the guidelines and everything is happy, or it's not and running local
jobs or the pep8 CI job will let them know right away and they can fix
it. No guessing on whether or not someone is going to take a stand on
following the guidelines or not.

This will also make it easier on the code reviewers. The more we can
automate, the more time we can spend in code reviews making sure the
logic of the change is correct and less time looking at trivial coding
and style things.

Q: Should we use our hacking extensions for this?
A: Hacking has had to keep back linter requirements for a long time now.
   Current versions of the linters actually don't work with the way
   we've been hooking into them for our hacking checks. We will likely
   need to do away with those at some point so we can move on to the
   current linter releases. This will help ensure we have something in
   place when that time comes to make sure some checks are automated.

Q: Didn't you spend more time on this than the benefit we'll get from
   it?
A: Yeah, probably.

Change-Id: Ic13ba238a4a45c6219f4de131cfe0366219d722f
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
changes/53/700253/3
Sean McGinnis 2 years ago
parent
commit
3eb9b422f4
No known key found for this signature in database GPG Key ID: CE7EE4BFAF8D70C8
  1. 3
      cinder/api/common.py
  2. 3
      cinder/api/contrib/quotas.py
  3. 4
      cinder/api/contrib/volume_image_metadata.py
  4. 13
      cinder/api/openstack/wsgi.py
  5. 7
      cinder/backup/api.py
  6. 12
      cinder/cmd/api.py
  7. 7
      cinder/cmd/backup.py
  8. 10
      cinder/cmd/scheduler.py
  9. 12
      cinder/cmd/status.py
  10. 26
      cinder/cmd/volume.py
  11. 34
      cinder/cmd/volume_usage_audit.py
  12. 12
      cinder/db/sqlalchemy/api.py
  13. 4
      cinder/db/sqlalchemy/migrate_repo/manage.py
  14. 5
      cinder/image/cache.py
  15. 5
      cinder/keymgr/migration.py
  16. 7
      cinder/manager.py
  17. 3
      cinder/objects/cgsnapshot.py
  18. 2
      cinder/objects/consistencygroup.py
  19. 3
      cinder/objects/group_snapshot.py
  20. 2
      cinder/objects/qos_specs.py
  21. 3
      cinder/opts.py
  22. 5
      cinder/quota_utils.py
  23. 3
      cinder/test.py
  24. 6
      cinder/tests/functional/functional_helpers.py
  25. 2
      cinder/tests/functional/test_quotas.py
  26. 1
      cinder/tests/hacking/checks.py
  27. 3
      cinder/tests/unit/api/contrib/test_admin_actions.py
  28. 1
      cinder/tests/unit/api/contrib/test_backup_project_attribute.py
  29. 7
      cinder/tests/unit/api/contrib/test_backups.py
  30. 2
      cinder/tests/unit/api/contrib/test_capabilities.py
  31. 8
      cinder/tests/unit/api/contrib/test_cgsnapshots.py
  32. 7
      cinder/tests/unit/api/contrib/test_consistencygroups.py
  33. 2
      cinder/tests/unit/api/contrib/test_extended_snapshot_attributes.py
  34. 2
      cinder/tests/unit/api/contrib/test_hosts.py
  35. 3
      cinder/tests/unit/api/contrib/test_qos_specs_manage.py
  36. 14
      cinder/tests/unit/api/contrib/test_quotas.py
  37. 2
      cinder/tests/unit/api/contrib/test_quotas_classes.py
  38. 3
      cinder/tests/unit/api/contrib/test_scheduler_stats.py
  39. 3
      cinder/tests/unit/api/contrib/test_services.py
  40. 3
      cinder/tests/unit/api/contrib/test_snapshot_actions.py
  41. 3
      cinder/tests/unit/api/contrib/test_snapshot_manage.py
  42. 3
      cinder/tests/unit/api/contrib/test_snapshot_unmanage.py
  43. 3
      cinder/tests/unit/api/contrib/test_types_extra_specs.py
  44. 6
      cinder/tests/unit/api/contrib/test_types_manage.py
  45. 3
      cinder/tests/unit/api/contrib/test_used_limits.py
  46. 2
      cinder/tests/unit/api/contrib/test_volume_actions.py
  47. 2
      cinder/tests/unit/api/contrib/test_volume_image_metadata.py
  48. 3
      cinder/tests/unit/api/contrib/test_volume_manage.py
  49. 7
      cinder/tests/unit/api/contrib/test_volume_transfer.py
  50. 2
      cinder/tests/unit/api/contrib/test_volume_type_access.py
  51. 3
      cinder/tests/unit/api/contrib/test_volume_unmanage.py
  52. 4
      cinder/tests/unit/api/openstack/test_wsgi.py
  53. 10
      cinder/tests/unit/api/test_common.py
  54. 1
      cinder/tests/unit/api/v2/fakes.py
  55. 2
      cinder/tests/unit/api/v2/test_snapshot_metadata.py
  56. 3
      cinder/tests/unit/api/v2/test_snapshots.py
  57. 2
      cinder/tests/unit/api/v2/test_types.py
  58. 2
      cinder/tests/unit/api/v2/test_volume_metadata.py
  59. 4
      cinder/tests/unit/api/v2/test_volumes.py
  60. 1
      cinder/tests/unit/api/v3/fakes.py
  61. 1
      cinder/tests/unit/api/v3/stubs.py
  62. 7
      cinder/tests/unit/api/v3/test_attachments.py
  63. 3
      cinder/tests/unit/api/v3/test_backups.py
  64. 2
      cinder/tests/unit/api/v3/test_cluster.py
  65. 7
      cinder/tests/unit/api/v3/test_group_snapshots.py
  66. 8
      cinder/tests/unit/api/v3/test_group_specs.py
  67. 2
      cinder/tests/unit/api/v3/test_group_types.py
  68. 7
      cinder/tests/unit/api/v3/test_groups.py
  69. 3
      cinder/tests/unit/api/v3/test_limits.py
  70. 3
      cinder/tests/unit/api/v3/test_messages.py
  71. 7
      cinder/tests/unit/api/v3/test_resource_filters.py
  72. 3
      cinder/tests/unit/api/v3/test_snapshot_manage.py
  73. 3
      cinder/tests/unit/api/v3/test_snapshots.py
  74. 3
      cinder/tests/unit/api/v3/test_volume_manage.py
  75. 2
      cinder/tests/unit/api/v3/test_volume_metadata.py
  76. 9
      cinder/tests/unit/api/v3/test_volume_transfer.py
  77. 6
      cinder/tests/unit/api/v3/test_volumes.py
  78. 3
      cinder/tests/unit/api/v3/test_workers.py
  79. 3
      cinder/tests/unit/attachments/test_attachments_api.py
  80. 3
      cinder/tests/unit/attachments/test_attachments_manager.py
  81. 2
      cinder/tests/unit/backup/drivers/test_backup_ceph.py
  82. 2
      cinder/tests/unit/backup/drivers/test_backup_driver_base.py
  83. 7
      cinder/tests/unit/backup/drivers/test_backup_glusterfs.py
  84. 7
      cinder/tests/unit/backup/drivers/test_backup_google.py
  85. 8
      cinder/tests/unit/backup/drivers/test_backup_nfs.py
  86. 7
      cinder/tests/unit/backup/drivers/test_backup_posix.py
  87. 9
      cinder/tests/unit/backup/drivers/test_backup_swift.py
  88. 6
      cinder/tests/unit/backup/drivers/test_backup_tsm.py
  89. 1
      cinder/tests/unit/backup/fake_swift_client.py
  90. 1
      cinder/tests/unit/backup/fake_swift_client2.py
  91. 4
      cinder/tests/unit/backup/test_backup.py
  92. 2
      cinder/tests/unit/backup/test_chunkeddriver.py
  93. 2
      cinder/tests/unit/backup/test_rpcapi.py
  94. 4
      cinder/tests/unit/brick/test_brick_lvm.py
  95. 2
      cinder/tests/unit/cast_as_call.py
  96. 4
      cinder/tests/unit/cmd/test_status.py
  97. 9
      cinder/tests/unit/compute/test_nova.py
  98. 3
      cinder/tests/unit/db/test_cluster.py
  99. 3
      cinder/tests/unit/db/test_purge.py
  100. 2
      cinder/tests/unit/fake_notifier.py

3
cinder/api/common.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import enum
import json
import os
import re
import enum
from oslo_config import cfg
from oslo_log import log as logging
from six.moves import urllib

3
cinder/api/contrib/quotas.py

@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import webob
from oslo_log import log as logging
from oslo_utils import strutils
import webob
from cinder.api import extensions
from cinder.api.openstack import wsgi

4
cinder/api/contrib/volume_image_metadata.py

@ -13,11 +13,10 @@
# under the License.
"""The Volume Image Metadata API extension."""
from oslo_log import log as logging
from six.moves import http_client
import webob
from oslo_log import log as logging
from cinder.api import common
from cinder.api import extensions
from cinder.api.openstack import wsgi
@ -29,7 +28,6 @@ from cinder import objects
from cinder.policies import volume_metadata as policy
from cinder import volume
LOG = logging.getLogger(__name__)

13
cinder/api/openstack/wsgi.py

@ -14,13 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
# TODO(smcginnis) update this once six has support for collections.abc
# (https://github.com/benjaminp/six/pull/241) or clean up once we drop py2.7.
try:
from collections.abc import Callable
except ImportError:
from collections import Callable
from collections import abc
import functools
import inspect
import math
@ -39,15 +33,12 @@ import webob.exc
from cinder.api.openstack import api_version_request as api_version
from cinder.api.openstack import versioned_method
from cinder import exception
from cinder import i18n
i18n.enable_lazy()
from cinder.i18n import _
from cinder import utils
from cinder.wsgi import common as wsgi
LOG = logging.getLogger(__name__)
SUPPORTED_CONTENT_TYPES = (
@ -1095,7 +1086,7 @@ class ControllerMetaclass(type):
versioned_methods.append(getattr(base, VER_METHOD_ATTR))
for key, value in cls_dict.items():
if not isinstance(value, Callable):
if not isinstance(value, abc.Callable):
continue
if getattr(value, 'wsgi_action', None):
actions[value.wsgi_action] = key

7
cinder/backup/api.py

@ -15,18 +15,17 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Handles all requests relating to the volume backups service.
"""
"""Handles all requests relating to the volume backups service."""
from datetime import datetime
import random
from eventlet import greenthread
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import strutils
from pytz import timezone
import random
from cinder.backup import rpcapi as backup_rpcapi
from cinder.common import constants

12
cinder/cmd/api.py

@ -17,31 +17,27 @@
"""Starter script for Cinder OS API."""
import eventlet
eventlet.monkey_patch()
import logging as python_logging
import sys
from cinder import objects
import eventlet # noqa
eventlet.monkey_patch()
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from cinder import i18n
from cinder import i18n # noqa
i18n.enable_lazy()
# Need to register global_opts
from cinder.common import config
from cinder import coordination
from cinder import objects
from cinder import rpc
from cinder import service
from cinder import utils
from cinder import version
CONF = cfg.CONF

7
cinder/cmd/backup.py

@ -26,7 +26,6 @@ import sys
# share the same context.
import eventlet
eventlet.monkey_patch()
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
@ -34,13 +33,11 @@ from oslo_privsep import priv_context
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from cinder import i18n
i18n.enable_lazy()
# Need to register global_opts
from cinder.common import config # noqa
from cinder.db import api as session
from cinder import i18n
i18n.enable_lazy()
from cinder import objects
from cinder import service
from cinder import utils

10
cinder/cmd/scheduler.py

@ -17,22 +17,20 @@
"""Starter script for Cinder Scheduler."""
import eventlet
eventlet.monkey_patch()
import logging as python_logging
import sys
import eventlet
eventlet.monkey_patch()
from oslo_config import cfg
from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from cinder import i18n
i18n.enable_lazy()
# Need to register global_opts
from cinder.common import config # noqa
from cinder import i18n
i18n.enable_lazy()
from cinder import objects
from cinder import service
from cinder import utils

12
cinder/cmd/status.py

@ -18,21 +18,19 @@
import os
import sys
from oslo_config import cfg
from oslo_upgradecheck import upgradecheck as uc
from cinder import context
from cinder import db
from cinder import exception
from cinder import objects
from cinder import service # noqa
from oslo_config import cfg
from oslo_upgradecheck import upgradecheck as uc
from cinder.policy import DEFAULT_POLICY_FILENAME
import cinder.service # noqa
# Need to import service to load config
from cinder import service # noqa
# We must first register Cinder's objects. Otherwise
# we cannot import the volume manager.
objects.register_all()
import cinder.volume.manager as volume_manager
CONF = cfg.CONF

26
cinder/cmd/volume.py

@ -16,11 +16,14 @@
# under the License.
"""Starter script for Cinder Volume."""
import logging as python_logging
import os
import re
import shlex
import sys
import eventlet
import eventlet.tpool
import os
# Monkey patching must go before the oslo.log import, otherwise
# oslo.context will not use greenthread thread local and all greenthreads
# will share the same context.
@ -30,36 +33,25 @@ if os.name == 'nt':
eventlet.monkey_patch(os=False)
else:
eventlet.monkey_patch()
import logging as python_logging
import re
from cinder import exception
from cinder import objects
import shlex
import sys
from oslo_config import cfg
from oslo_log import log as logging
from oslo_privsep import priv_context
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from cinder import i18n
i18n.enable_lazy()
# Need to register global_opts
from cinder.common import config # noqa
from cinder.common import constants
from cinder.db import api as session
from cinder import exception
from cinder import i18n
i18n.enable_lazy()
from cinder.i18n import _
from cinder import objects
from cinder import service
from cinder import utils
from cinder import version
CONF = cfg.CONF
host_opt = cfg.StrOpt('backend_host', help='Backend override of host value.')

34
cinder/cmd/volume_usage_audit.py

@ -15,35 +15,35 @@
# under the License.
"""
Cron script to generate usage notifications for volumes existing during
the audit period.
Cron script to generate usage notifications for volumes existing during
the audit period.
Together with the notifications generated by volumes
create/delete/resize, over that time period, this allows an external
system consuming usage notification feeds to calculate volume usage
for each tenant.
Together with the notifications generated by volumes
create/delete/resize, over that time period, this allows an external
system consuming usage notification feeds to calculate volume usage
for each tenant.
Time periods are specified as 'hour', 'month', 'day' or 'year'
Time periods are specified as 'hour', 'month', 'day' or 'year'
- `hour` - previous hour. If run at 9:07am, will generate usage for
8-9am.
- `month` - previous month. If the script is run April 1, it will
generate usages for March 1 through March 31.
- `day` - previous day. if run on July 4th, it generates usages for
July 3rd.
- `year` - previous year. If run on Jan 1, it generates usages for
Jan 1 through Dec 31 of the previous year.
- `hour` - previous hour. If run at 9:07am, will generate usage for
8-9am.
- `month` - previous month. If the script is run April 1, it will
generate usages for March 1 through March 31.
- `day` - previous day. if run on July 4th, it generates usages for
July 3rd.
- `year` - previous year. If run on Jan 1, it generates usages for
Jan 1 through Dec 31 of the previous year.
"""
import datetime
import iso8601
import sys
import iso8601
from oslo_config import cfg
from oslo_log import log as logging
from cinder import i18n
from cinder import i18n # noqa
i18n.enable_lazy()
from cinder import context
from cinder.i18n import _

12
cinder/db/sqlalchemy/api.py

@ -18,14 +18,8 @@
"""Implementation of SQLAlchemy backend."""
import collections
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from collections import abc
import datetime as dt
import functools
import itertools
@ -7135,7 +7129,7 @@ def condition_db_filter(model, field, value):
"""
orm_field = getattr(model, field)
# For values that must match and are iterables we use IN
if (isinstance(value, Iterable) and
if (isinstance(value, abc.Iterable) and
not isinstance(value, six.string_types)):
# We cannot use in_ when one of the values is None
if None not in value:
@ -7161,7 +7155,7 @@ def condition_not_db_filter(model, field, value, auto_none=True):
result = ~condition_db_filter(model, field, value)
if (auto_none
and ((isinstance(value, Iterable) and
and ((isinstance(value, abc.Iterable) and
not isinstance(value, six.string_types)
and None not in value)
or (value is not None))):

4
cinder/db/sqlalchemy/migrate_repo/manage.py

@ -15,10 +15,10 @@
import os
from cinder.db.sqlalchemy import migrate_repo
from migrate.versioning.shell import main
from cinder.db.sqlalchemy import migrate_repo
if __name__ == '__main__':
main(debug='False',

5
cinder/image/cache.py

@ -12,12 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from pytz import timezone
import six
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
from pytz import timezone
import six
from cinder import objects
from cinder import rpc

5
cinder/keymgr/migration.py

@ -16,13 +16,12 @@
import binascii
import itertools
from oslo_config import cfg
from oslo_log import log as logging
from barbicanclient import client as barbican_client
from castellan import options as castellan_options
from keystoneauth1 import loading as ks_loading
from keystoneauth1 import session as ks_session
from oslo_config import cfg
from oslo_log import log as logging
from cinder import context
from cinder import coordination

7
cinder/manager.py

@ -51,7 +51,8 @@ This module provides Manager, a base class for managers.
"""
from eventlet import greenpool
from eventlet import tpool
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
@ -67,10 +68,6 @@ from cinder import rpc
from cinder.scheduler import rpcapi as scheduler_rpcapi
from cinder import utils
from eventlet import greenpool
from eventlet import tpool
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

3
cinder/objects/cgsnapshot.py

@ -12,12 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_versionedobjects import fields
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder import objects
from cinder.objects import base
from oslo_versionedobjects import fields
@base.CinderObjectRegistry.register

2
cinder/objects/consistencygroup.py

@ -13,6 +13,7 @@
# under the License.
from oslo_utils import versionutils
from oslo_versionedobjects import fields
from cinder import db
from cinder import exception
@ -20,7 +21,6 @@ from cinder.i18n import _
from cinder import objects
from cinder.objects import base
from cinder.objects import fields as c_fields
from oslo_versionedobjects import fields
@base.CinderObjectRegistry.register

3
cinder/objects/group_snapshot.py

@ -12,12 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_versionedobjects import fields
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder import objects
from cinder.objects import base
from oslo_versionedobjects import fields
@base.CinderObjectRegistry.register

2
cinder/objects/qos_specs.py

@ -12,6 +12,7 @@
from oslo_db import exception as db_exc
from oslo_log import log as logging
from oslo_versionedobjects import fields
from cinder import db
from cinder import exception
@ -19,7 +20,6 @@ from cinder.i18n import _
from cinder import objects
from cinder.objects import base
from cinder.objects import fields as c_fields
from oslo_versionedobjects import fields
LOG = logging.getLogger(__name__)

3
cinder/opts.py

@ -25,9 +25,8 @@ import itertools
from keystoneauth1 import loading
from cinder import objects
from cinder import objects # noqa
objects.register_all()
from cinder.api import common as cinder_api_common
from cinder.api.middleware import auth as cinder_api_middleware_auth
from cinder.api.views import versions as cinder_api_views_versions

5
cinder/quota_utils.py

@ -12,13 +12,12 @@
# 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 oslo_config import cfg
from oslo_log import log as logging
from keystoneauth1 import identity
from keystoneauth1 import loading as ka_loading
from keystoneclient import client
from keystoneclient import exceptions
from oslo_config import cfg
from oslo_log import log as logging
from cinder import db
from cinder import exception

3
cinder/test.py

@ -24,12 +24,12 @@ import copy
import logging
import os
import sys
from unittest import mock
import uuid
from eventlet import tpool
import fixtures
from keystonemiddleware import auth_token
import mock
from oslo_concurrency import lockutils
from oslo_config import fixture as config_fixture
from oslo_log.fixture import logging_error as log_fixture
@ -58,7 +58,6 @@ from cinder.tests.unit import fake_notifier
from cinder.volume import volume_types
from cinder.volume import volume_utils
CONF = config.CONF
_DB_CACHE = None

6
cinder/tests/functional/functional_helpers.py

@ -13,17 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Provides common functionality for functional tests
"""
"""Provides common functionality for functional tests."""
import os.path
import random
import string
import time
from unittest import mock
import uuid
import fixtures
import mock
from oslo_config import cfg
from cinder import service

2
cinder/tests/functional/test_quotas.py

@ -11,7 +11,7 @@
# 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
import uuid
from cinder import quota

1
cinder/tests/hacking/checks.py

@ -14,6 +14,7 @@
import ast
import re
import six
"""

3
cinder/tests/unit/api/contrib/test_admin_actions.py

@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import ddt
import fixtures
import mock
from oslo_concurrency import lockutils
from oslo_config import fixture as config_fixture
import oslo_messaging as messaging

1
cinder/tests/unit/api/contrib/test_backup_project_attribute.py

@ -13,7 +13,6 @@
# under the License.
import ddt
from oslo_serialization import jsonutils
import webob

7
cinder/tests/unit/api/contrib/test_backups.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for Backup code.
"""
"""Tests for Backup code."""
from unittest import mock
import ddt
import mock
from oslo_serialization import jsonutils
from oslo_utils import timeutils
import six

2
cinder/tests/unit/api/contrib/test_capabilities.py

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

8
cinder/tests/unit/api/contrib/test_cgsnapshots.py

@ -13,11 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for cgsnapshot code.
"""
"""Tests for cgsnapshot code."""
from unittest import mock
import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob
@ -30,7 +29,6 @@ from cinder import objects
from cinder import test
from cinder.tests.unit.api import fakes
from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit import utils
import cinder.volume

7
cinder/tests/unit/api/contrib/test_consistencygroups.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for consistency group code.
"""
"""Tests for consistency group code."""
from unittest import mock
import ddt
import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob

2
cinder/tests/unit/api/contrib/test_extended_snapshot_attributes.py

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob

2
cinder/tests/unit/api/contrib/test_hosts.py

@ -14,7 +14,7 @@
# under the License.
import datetime
import mock
from unittest import mock
import iso8601
from oslo_utils import timeutils

3
cinder/tests/unit/api/contrib/test_qos_specs_manage.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 six.moves import http_client
import webob

14
cinder/tests/unit/api/contrib/test_quotas.py

@ -14,14 +14,14 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for cinder.api.contrib.quotas.py
"""
"""Tests for cinder.api.contrib.quotas.py"""
from unittest import mock
import uuid
import ddt
import mock
import uuid
from oslo_config import cfg
from oslo_config import fixture as config_fixture
import webob.exc
from cinder.api.contrib import quotas
@ -34,10 +34,6 @@ from cinder.tests.unit import fake_constants as fake
from cinder.tests.unit import test_db_api
from oslo_config import cfg
from oslo_config import fixture as config_fixture
CONF = cfg.CONF

2
cinder/tests/unit/api/contrib/test_quotas_classes.py

@ -18,7 +18,7 @@ Tests for cinder.api.contrib.quota_classes.py
"""
import mock
from unittest import mock
from cinder.api.contrib import quota_classes
from cinder import context

3
cinder/tests/unit/api/contrib/test_scheduler_stats.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
import webob
from cinder.api.contrib import scheduler_stats

3
cinder/tests/unit/api/contrib/test_services.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
from unittest import mock
import ddt
import iso8601
import mock
from oslo_config import cfg
from six.moves import http_client

3
cinder/tests/unit/api/contrib/test_snapshot_actions.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_serialization import jsonutils
from six.moves import http_client
import webob

3
cinder/tests/unit/api/contrib/test_snapshot_manage.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
import oslo_messaging as messaging
from oslo_serialization import jsonutils

3
cinder/tests/unit/api/contrib/test_snapshot_unmanage.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob

3
cinder/tests/unit/api/contrib/test_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_config import cfg
from oslo_utils import timeutils
import webob

6
cinder/tests/unit/api/contrib/test_types_manage.py

@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import six
import webob
from unittest import mock
import ddt
from oslo_utils import strutils
import six
import webob
from cinder.api.contrib import types_manage
from cinder import context

3
cinder/tests/unit/api/contrib/test_used_limits.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 cinder.api.contrib import used_limits
from cinder.api import microversions as mv

2
cinder/tests/unit/api/contrib/test_volume_actions.py

@ -13,10 +13,10 @@
# under the License.
import datetime
from unittest import mock
import uuid
import ddt
import mock
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_serialization import jsonutils

2
cinder/tests/unit/api/contrib/test_volume_image_metadata.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import uuid
from oslo_policy import policy as oslo_policy

3
cinder/tests/unit/api/contrib/test_volume_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
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_serialization import jsonutils

7
cinder/tests/unit/api/contrib/test_volume_transfer.py

@ -13,11 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for volume transfer code.
"""
"""Tests for volume transfer code."""
from unittest import mock
import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob

2
cinder/tests/unit/api/contrib/test_volume_type_access.py

@ -12,7 +12,7 @@
# under the License.
import datetime
import mock
from unittest import mock
from six.moves import http_client
import webob

3
cinder/tests/unit/api/contrib/test_volume_unmanage.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob

4
cinder/tests/unit/api/openstack/test_wsgi.py

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import ddt
import inspect
from unittest import mock
import mock
import ddt
from oslo_utils import encodeutils
from six.moves import http_client
import webob

10
cinder/tests/unit/api/test_common.py

@ -14,18 +14,16 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Test suites for 'common' code used throughout the OpenStack HTTP API.
"""
"""Test suites for 'common' code used throughout the OpenStack HTTP API."""
from unittest import mock
import ddt
import mock
from oslo_config import cfg
from testtools import matchers
import webob
import webob.exc
from oslo_config import cfg
from cinder.api import common
from cinder import test

1
cinder/tests/unit/api/v2/fakes.py

@ -14,6 +14,7 @@
# under the License.
import datetime
import iso8601
from cinder import exception as exc

2
cinder/tests/unit/api/v2/test_snapshot_metadata.py

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import ddt
import mock
from oslo_serialization import jsonutils
from six.moves import http_client
import webob

3
cinder/tests/unit/api/v2/test_snapshots.py

@ -14,8 +14,9 @@
# under the License.
import datetime
from unittest import mock
import ddt
import mock
from oslo_config import cfg
import pytz
from six.moves import http_client

2
cinder/tests/unit/api/v2/test_types.py

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import mock
from oslo_utils import timeutils
import six
import webob

2
cinder/tests/unit/api/v2/test_volume_metadata.py

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
from six.moves import http_client

4
cinder/tests/unit/api/v2/test_volumes.py

@ -15,12 +15,12 @@
import datetime
import iso8601
import json
from unittest import mock
import ddt
import fixtures
import mock
import iso8601
from oslo_config import cfg
import six
from six.moves import http_client

1
cinder/tests/unit/api/v3/fakes.py

@ -11,6 +11,7 @@
# under the License.
import datetime
import iso8601
from cinder.tests.unit import fake_constants as fake

1
cinder/tests/unit/api/v3/stubs.py

@ -11,6 +11,7 @@
# under the License.
import datetime
import iso8601
from cinder.tests.unit import fake_constants as fake

7
cinder/tests/unit/api/v3/test_attachments.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for attachments Api.
"""
"""Tests for attachments Api."""
from unittest import mock
import ddt
import mock
from oslo_policy import policy as oslo_policy
from cinder.api import microversions as mv

3
cinder/tests/unit/api/v3/test_backups.py

@ -16,8 +16,9 @@
"""The backups V3 api."""
import copy
from unittest import mock
import ddt
import mock
from oslo_serialization import jsonutils
from oslo_utils import strutils
import webob

2
cinder/tests/unit/api/v3/test_cluster.py

@ -14,10 +14,10 @@
# under the License.
import datetime
from unittest import mock
import ddt
import iso8601
import mock
from oslo_utils import versionutils
from cinder.api import extensions

7
cinder/tests/unit/api/v3/test_group_snapshots.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for group_snapshot code.
"""
"""Tests for group_snapshot code."""
from unittest import mock
import ddt
import mock
from oslo_policy import policy as oslo_policy
from six.moves import http_client
import webob

8
cinder/tests/unit/api/v3/test_group_specs.py

@ -13,17 +13,17 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import webob
from cinder.api import microversions as mv
from cinder.api.v3 import group_specs as v3_group_specs
from cinder import context
from cinder import db
from cinder import exception
from cinder import rpc
from cinder import test
from cinder.api import microversions as mv
from cinder.api.v3 import group_specs as v3_group_specs
from cinder.tests.unit.api import fakes
from cinder.tests.unit import fake_constants as fake

2
cinder/tests/unit/api/v3/test_group_types.py

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import ddt
import mock
from oslo_utils import strutils
from oslo_utils import timeutils
import six

7
cinder/tests/unit/api/v3/test_groups.py

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for group code.
"""
"""Tests for group code."""
from unittest import mock
import ddt
import mock
from six.moves import http_client
import webob

3
cinder/tests/unit/api/v3/test_limits.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 cinder.api import microversions as mv
from cinder.api.openstack import api_version_request as api_version

3
cinder/tests/unit/api/v3/test_messages.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 six.moves import http_client
from cinder.api import extensions

7
cinder/tests/unit/api/v3/test_resource_filters.py

@ -10,12 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for resource filters API.
"""
"""Tests for resource filters API."""
from unittest import mock
import ddt
import mock
import six
from cinder.api import microversions as mv

3
cinder/tests/unit/api/v3/test_snapshot_manage.py

@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock