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>
This commit is contained in:
Sean McGinnis 2019-12-20 16:06:45 -06:00
parent d9ce598f0c
commit 3eb9b422f4
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
378 changed files with 721 additions and 855 deletions

View File

@ -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

View File

@ -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

View File

@ -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__)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.')

View File

@ -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 _

View File

@ -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))):

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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__)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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__)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
from six.moves import http_client

View File

@ -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 strutils
from cinder.api import microversions as mv

View File

@ -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
from six.moves import http_client

View File

@ -10,9 +10,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

View File

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

View File

@ -12,12 +12,12 @@
# under the License.
import datetime
import ddt
import iso8601
import json
from unittest import mock
import ddt
import fixtures
import mock
import iso8601
from oslo_serialization import jsonutils
from oslo_utils import strutils
from six.moves import http_client

View File

@ -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 six.moves import http_client
import webob

View File

@ -10,7 +10,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_policy import policy as oslo_policy

View File

@ -10,7 +10,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_utils import importutils

View File

@ -19,10 +19,10 @@ import json
import os
import tempfile
import threading
from unittest import mock
import uuid
import ddt
import mock
from os_brick.initiator import linuxrbd
from oslo_concurrency import processutils
from oslo_config import cfg

View File

@ -14,9 +14,9 @@
# under the License.
""" Tests for the backup service base driver. """
from unittest import mock
import uuid
import mock
from oslo_serialization import jsonutils
from cinder.backup import driver

View File

@ -12,13 +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.
"""
Tests for GlusterFS backup driver.
"""
"""Tests for GlusterFS backup driver."""
import os
from unittest import mock
import mock
from os_brick.remotefs import remotefs as remotefs_brick
from cinder.backup.drivers import glusterfs

View File

@ -14,10 +14,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.
"""
Tests for Google Backup code.
"""
"""Tests for Google Backup code."""
import bz2
import filecmp
@ -26,10 +23,10 @@ import os
import shutil
import tempfile
import threading
from unittest import mock
import zlib
from eventlet import tpool
import mock
from oslo_utils import units
from cinder.backup.drivers import gcs as google_dr

View File

@ -12,12 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for Backup NFS driver.
"""Tests for Backup NFS driver."""
"""
import bz2
import ddt
import filecmp
import hashlib
import os
@ -25,10 +22,11 @@ import shutil
import stat
import tempfile
import threading
from unittest import mock
import zlib
import ddt
from eventlet import tpool
import mock
from os_brick import exception as brick_exception
from os_brick.remotefs import remotefs as remotefs_brick
from oslo_config import cfg

View File

@ -12,14 +12,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for Posix backup driver.
"""
"""Tests for Posix backup driver."""
import os
from unittest import mock
import mock
from six.moves import builtins
from cinder.backup.drivers import posix

View File

@ -12,23 +12,20 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests for Backup swift code.
"""
"""Tests for Backup swift code."""
import bz2
import ddt
import filecmp
import hashlib
import os
import shutil
import tempfile
import threading
from unittest import mock
import zlib
import ddt
from eventlet import tpool
import mock
from oslo_config import cfg
from swiftclient import client as swift

View File

@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
#
"""
Tests for volume backup to IBM Tivoli Storage Manager (TSM).
"""
"""Tests for volume backup to IBM Tivoli Storage Manager (TSM)."""
import json
import mock
import posix
from unittest import mock
from oslo_concurrency import processutils as putils
from oslo_utils import timeutils

View File

@ -20,7 +20,6 @@ import zlib
import six
from six.moves import http_client
from swiftclient import client as swift

View File

@ -20,7 +20,6 @@ import socket
import tempfile
from six.moves import http_client
from swiftclient import client as swift

View File

@ -15,12 +15,12 @@
"""Tests for Backup code."""
import copy
import ddt
import os
from unittest import mock
import uuid
import ddt
from eventlet import tpool
import mock
from os_brick.initiator.connectors import fake as fake_connectors
from oslo_config import cfg
from oslo_db import exception as db_exc

View File

@ -14,9 +14,9 @@
"""Tests for the base chunkedbackupdriver class."""
import json
from unittest import mock
import uuid
import mock
from oslo_config import cfg
from oslo_utils import units

View File

@ -16,7 +16,7 @@
Unit Tests for cinder.backup.rpcapi
"""
import mock
from unittest import mock
from cinder.backup import rpcapi as backup_rpcapi
from cinder import objects

View File

@ -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 oslo_concurrency import processutils
from cinder.brick.local_dev import lvm as brick

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
def mock_cast_as_call(obj=None):

View File

@ -12,10 +12,10 @@
"""Unit tests for the cinder-status CLI interfaces."""
import ddt
import mock
from unittest import mock
import uuid
import ddt
from oslo_config import cfg
from oslo_upgradecheck import upgradecheck as uc
import testtools

View File

@ -12,17 +12,18 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import ddt
from keystoneauth1 import exceptions as ks_exc
import mock
from keystoneauth1 import loading as ks_loading
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
from cinder.compute import nova
from cinder import context
from cinder.message import message_field
from cinder import test
from keystoneauth1 import loading as ks_loading
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
CONF = cfg.CONF

View File

@ -15,7 +15,8 @@
"""Tests for cluster table related operations."""
import mock
from unittest import mock
from oslo_config import cfg
from sqlalchemy.orm import exc

View File

@ -19,6 +19,7 @@ import datetime
import uuid
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import utils as sqlalchemyutils
from oslo_utils import timeutils
from sqlalchemy.dialects import sqlite
@ -28,8 +29,6 @@ from cinder.db.sqlalchemy import api as db_api
from cinder import exception
from cinder import test
from oslo_db.sqlalchemy import utils as sqlalchemyutils
class PurgeDeletedTest(test.TestCase):

View File

@ -14,8 +14,8 @@
import collections
import functools
import json
import oslo_messaging as messaging
from cinder import rpc

Some files were not shown because too many files have changed in this diff Show More