From 50ff4ec2fe6995d46c5f3afaefabd443cdf207d1 Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Fri, 4 Apr 2014 16:44:30 +0300 Subject: [PATCH] Order imports in alphabetical order (9/9) This patch fixes all the missed and newly introduced violations of the H306 style checking rule and enables it in tox. Change-Id: I5566e66421d5397c0103958f02ea38e6e3c68892 Implements: blueprint reduce-flake8-ignored-rules (partial) --- bin/heat-api | 10 +++---- bin/heat-api-cfn | 10 +++---- bin/heat-api-cloudwatch | 10 +++---- bin/heat-engine | 7 ++--- bin/heat-manage | 3 +- .../nova_flavor/tests/test_nova_flavor.py | 14 +++++----- .../rackspace/resources/cloud_loadbalancer.py | 28 +++++++++---------- doc/source/ext/resources.py | 11 ++++---- heat/api/middleware/fault.py | 9 +++--- heat/common/config.py | 1 - heat/common/crypt.py | 1 + heat/common/custom_backend_auth.py | 4 +-- heat/common/policy.py | 1 - .../versions/043_migrate_template_versions.py | 3 +- heat/engine/constraints.py | 3 +- heat/engine/resources/image.py | 2 +- heat/engine/resources/instance.py | 4 +-- heat/engine/resources/server.py | 2 +- heat/engine/service.py | 2 +- heat/rpc/client.py | 3 +- heat/tests/db/test_migrations.py | 3 +- heat/tests/fakes.py | 4 +-- heat/tests/test_api_openstack_v1_util.py | 1 - ...est_api_openstack_v1_views_views_common.py | 1 - heat/tests/test_clients.py | 5 ++-- heat/tests/test_cloud_config.py | 4 +-- heat/tests/test_common_serializers.py | 1 + heat/tests/test_engine_service.py | 4 +-- heat/tests/test_fault_middleware.py | 5 ++-- heat/tests/test_function.py | 3 +- heat/tests/test_heatclient.py | 11 ++++---- heat/tests/test_image.py | 1 - heat/tests/test_multi_part.py | 7 ++--- heat/tests/test_nested_stack.py | 8 +++--- heat/tests/test_neutron_network_gateway.py | 2 +- heat/tests/test_neutron_vpnservice.py | 2 +- heat/tests/test_notifications.py | 1 - heat/tests/test_nova_utils.py | 2 +- heat/tests/test_plugin_manager.py | 3 +- heat/tests/test_provider_template.py | 2 -- heat/tests/test_random_string.py | 1 - heat/tests/test_resource.py | 3 +- heat/tests/test_restarter.py | 1 - heat/tests/test_scheduler.py | 5 ++-- heat/tests/test_short_id.py | 2 +- heat/tests/test_signal.py | 3 -- heat/tests/test_software_config.py | 6 ++-- heat/tests/test_sqlalchemy_api.py | 4 +-- heat/tests/test_ssl_middleware.py | 3 +- heat/tests/test_support.py | 1 - heat/tests/test_template_format.py | 2 +- .../test_version_negotiation_middleware.py | 3 +- heat/tests/test_waitcondition.py | 2 +- heat/tests/test_watch.py | 2 +- heat/tests/test_wsgi.py | 1 + heat/tests/v1_1/fakes.py | 3 +- tox.ini | 4 +-- 57 files changed, 104 insertions(+), 140 deletions(-) diff --git a/bin/heat-api b/bin/heat-api index 3d9bcc85e..721d9f189 100755 --- a/bin/heat-api +++ b/bin/heat-api @@ -30,18 +30,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) -from heat.openstack.common import gettextutils - -gettextutils.install('heat', lazy=False) - from oslo.config import cfg from heat.common import config -from heat.common import wsgi from heat.common import notify - +from heat.common import wsgi +from heat.openstack.common import gettextutils from heat.openstack.common import log as logging +gettextutils.install('heat', lazy=False) + LOG = logging.getLogger('heat.api') if __name__ == '__main__': diff --git a/bin/heat-api-cfn b/bin/heat-api-cfn index a5e753aec..abc1b3854 100755 --- a/bin/heat-api-cfn +++ b/bin/heat-api-cfn @@ -32,18 +32,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) -from heat.openstack.common import gettextutils - -gettextutils.install('heat', lazy=False) - from oslo.config import cfg from heat.common import config -from heat.common import wsgi from heat.common import notify - +from heat.common import wsgi +from heat.openstack.common import gettextutils from heat.openstack.common import log as logging +gettextutils.install('heat', lazy=False) + LOG = logging.getLogger('heat.api.cfn') if __name__ == '__main__': diff --git a/bin/heat-api-cloudwatch b/bin/heat-api-cloudwatch index 803cffe47..4d7160914 100755 --- a/bin/heat-api-cloudwatch +++ b/bin/heat-api-cloudwatch @@ -32,18 +32,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')): sys.path.insert(0, possible_topdir) -from heat.openstack.common import gettextutils - -gettextutils.install('heat', lazy=False) - from oslo.config import cfg from heat.common import config -from heat.common import wsgi from heat.common import notify - +from heat.common import wsgi +from heat.openstack.common import gettextutils from heat.openstack.common import log as logging +gettextutils.install('heat', lazy=False) + LOG = logging.getLogger('heat.api.cloudwatch') if __name__ == '__main__': diff --git a/bin/heat-engine b/bin/heat-engine index fe83730e2..f20276c18 100755 --- a/bin/heat-engine +++ b/bin/heat-engine @@ -32,19 +32,16 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) -from heat.openstack.common import gettextutils - -gettextutils.install('heat', lazy=False) from oslo.config import cfg from heat.common import notify - +from heat.openstack.common import gettextutils from heat.openstack.common import log as logging from heat.openstack.common import service - from heat.rpc import api as rpc_api +gettextutils.install('heat', lazy=False) LOG = logging.getLogger('heat.engine') diff --git a/bin/heat-manage b/bin/heat-manage index baf26d7db..4045eea6d 100755 --- a/bin/heat-manage +++ b/bin/heat-manage @@ -24,10 +24,9 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'heat', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) +from heat.cmd import manage from heat.openstack.common import gettextutils gettextutils.install('heat') -from heat.cmd import manage - manage.main() diff --git a/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py b/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py index b89392736..0043883be 100644 --- a/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py +++ b/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py @@ -12,16 +12,16 @@ # under the License. import mock - -from heat.engine import parser -from heat.engine import template -from heat.engine import resource -from heat.tests.common import HeatTestCase -from heat.tests import utils from novaclient.exceptions import NotFound -from ..resources.nova_flavor import resource_mapping # noqa +from heat.engine import parser +from heat.engine import resource +from heat.engine import template +from heat.tests.common import HeatTestCase +from heat.tests import utils + from ..resources.nova_flavor import NovaFlavor # noqa +from ..resources.nova_flavor import resource_mapping # noqa flavor_template = { 'heat_template_version': '2013-05-23', diff --git a/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py b/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py index 075a0276e..193786cbd 100644 --- a/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py +++ b/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py @@ -11,7 +11,19 @@ # License for the specific language governing permissions and limitations # under the License. -"""Resources for Rackspace Cloud Loadbalancers.""" +import copy +import itertools + +from heat.common import exception +from heat.engine import attributes +from heat.engine import constraints +from heat.engine import function +from heat.engine import properties +from heat.engine.properties import Properties +from heat.engine import resource +from heat.engine import scheduler +from heat.openstack.common.gettextutils import _ +from heat.openstack.common import log as logging try: from pyrax.exceptions import NotFound @@ -23,20 +35,6 @@ except ImportError: PYRAX_INSTALLED = False -import copy -import itertools - -from heat.openstack.common import log as logging -from heat.openstack.common.gettextutils import _ -from heat.engine import attributes -from heat.engine import function -from heat.engine import scheduler -from heat.engine import constraints -from heat.engine import properties -from heat.engine import resource -from heat.engine.properties import Properties -from heat.common import exception - logger = logging.getLogger(__name__) diff --git a/doc/source/ext/resources.py b/doc/source/ext/resources.py index 60423e8b1..9dc063f58 100644 --- a/doc/source/ext/resources.py +++ b/doc/source/ext/resources.py @@ -14,17 +14,18 @@ import itertools +from docutils import nodes +import pydoc +from sphinx.util.compat import Directive + +from heat.engine import attributes from heat.engine import environment from heat.engine import plugin_manager -from heat.engine import resources from heat.engine import properties -from heat.engine import attributes +from heat.engine import resources from heat.engine import support from heat.openstack.common.gettextutils import _ -from docutils import nodes -from sphinx.util.compat import Directive -import pydoc global_env = environment.Environment({}, user_env=False) diff --git a/heat/api/middleware/fault.py b/heat/api/middleware/fault.py index 382ec7664..76820e92e 100644 --- a/heat/api/middleware/fault.py +++ b/heat/api/middleware/fault.py @@ -25,13 +25,14 @@ import traceback from oslo.config import cfg import webob -cfg.CONF.import_opt('debug', 'heat.openstack.common.log') -from heat.common import serializers from heat.common import exception -import heat.openstack.common.rpc.common as rpc_common - +from heat.common import serializers from heat.common import wsgi +from heat.openstack.common.rpc import common as rpc_common + + +cfg.CONF.import_opt('debug', 'heat.openstack.common.log') class Fault(object): diff --git a/heat/common/config.py b/heat/common/config.py index c548d5552..3ef5a4e43 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -22,7 +22,6 @@ from eventlet.green import socket from oslo.config import cfg from heat.common import wsgi - from heat.openstack.common import log as logging from heat.openstack.common import rpc diff --git a/heat/common/crypt.py b/heat/common/crypt.py index 12883e599..935d930d7 100644 --- a/heat/common/crypt.py +++ b/heat/common/crypt.py @@ -12,6 +12,7 @@ # under the License. import base64 + from Crypto.Cipher import AES from oslo.config import cfg diff --git a/heat/common/custom_backend_auth.py b/heat/common/custom_backend_auth.py index 5759029c2..4a390ab2c 100644 --- a/heat/common/custom_backend_auth.py +++ b/heat/common/custom_backend_auth.py @@ -20,11 +20,11 @@ Middleware for authenticating against custom backends. import logging +import webob.exc + from heat.openstack.common.gettextutils import _ from heat.openstack.common import local from heat.rpc import client as rpc_client -import webob.exc - LOG = logging.getLogger(__name__) diff --git a/heat/common/policy.py b/heat/common/policy.py index 29644782a..b0b35f0c7 100644 --- a/heat/common/policy.py +++ b/heat/common/policy.py @@ -20,7 +20,6 @@ from oslo.config import cfg from heat.common import exception - from heat.openstack.common import policy diff --git a/heat/db/sqlalchemy/migrate_repo/versions/043_migrate_template_versions.py b/heat/db/sqlalchemy/migrate_repo/versions/043_migrate_template_versions.py index eef71b3a3..2cdfa51dd 100644 --- a/heat/db/sqlalchemy/migrate_repo/versions/043_migrate_template_versions.py +++ b/heat/db/sqlalchemy/migrate_repo/versions/043_migrate_template_versions.py @@ -12,11 +12,12 @@ import copy import time + from migrate.versioning import util as migrate_util from sqlalchemy.orm import sessionmaker -from heat.openstack.common.gettextutils import _ from heat.db.sqlalchemy import models +from heat.openstack.common.gettextutils import _ def upgrade(migrate_engine): diff --git a/heat/engine/constraints.py b/heat/engine/constraints.py index c0e7af1e2..28db3683e 100644 --- a/heat/engine/constraints.py +++ b/heat/engine/constraints.py @@ -17,11 +17,10 @@ import re import six +from heat.common import exception from heat.engine import clients from heat.engine import resources -from heat.common import exception - class InvalidSchemaError(exception.Error): pass diff --git a/heat/engine/resources/image.py b/heat/engine/resources/image.py index bd3eccecc..006c02b62 100644 --- a/heat/engine/resources/image.py +++ b/heat/engine/resources/image.py @@ -12,8 +12,8 @@ # under the License. from heat.common import exception -from heat.engine.resources import nova_utils from heat.engine import constraints +from heat.engine.resources import nova_utils class ImageConstraint(constraints.BaseCustomConstraint): diff --git a/heat/engine/resources/instance.py b/heat/engine/resources/instance.py index e8f25b3ff..bb231ef12 100644 --- a/heat/engine/resources/instance.py +++ b/heat/engine/resources/instance.py @@ -16,8 +16,6 @@ import copy from oslo.config import cfg import six -cfg.CONF.import_opt('instance_user', 'heat.common.config') - from heat.common import exception from heat.engine import attributes from heat.engine import clients @@ -33,6 +31,8 @@ from heat.engine import signal_responder from heat.openstack.common.gettextutils import _ from heat.openstack.common import log as logging +cfg.CONF.import_opt('instance_user', 'heat.common.config') + logger = logging.getLogger(__name__) diff --git a/heat/engine/resources/server.py b/heat/engine/resources/server.py index f51f4ae34..60348d01c 100644 --- a/heat/engine/resources/server.py +++ b/heat/engine/resources/server.py @@ -12,9 +12,9 @@ # under the License. import copy +import uuid from oslo.config import cfg -import uuid from heat.common import exception from heat.engine import attributes diff --git a/heat/engine/service.py b/heat/engine/service.py index 664c525f0..68865b019 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -14,8 +14,8 @@ import functools import json -import six from oslo.config import cfg +import six import webob from heat.common import context diff --git a/heat/rpc/client.py b/heat/rpc/client.py index 6f40b4125..170c8ac27 100644 --- a/heat/rpc/client.py +++ b/heat/rpc/client.py @@ -17,9 +17,8 @@ Client side of the heat engine RPC API. """ -from heat.rpc import api - import heat.openstack.common.rpc.proxy +from heat.rpc import api class EngineClient(heat.openstack.common.rpc.proxy.RpcProxy): diff --git a/heat/tests/db/test_migrations.py b/heat/tests/db/test_migrations.py index 9aacf81ef..341c95520 100644 --- a/heat/tests/db/test_migrations.py +++ b/heat/tests/db/test_migrations.py @@ -28,9 +28,8 @@ import tempfile import uuid from migrate.versioning import repository -import sqlalchemy - from six.moves.urllib import parse as urlparse +import sqlalchemy from heat.db.sqlalchemy import migrate_repo from heat.db.sqlalchemy import migration diff --git a/heat/tests/fakes.py b/heat/tests/fakes.py index 5eb013c86..610e817ae 100644 --- a/heat/tests/fakes.py +++ b/heat/tests/fakes.py @@ -11,8 +11,6 @@ # License for the specific language governing permissions and limitations # under the License. -from heat.common import context - """ A fake server that "responds" to API methods with pre-canned responses. @@ -21,6 +19,8 @@ wrong the tests might raise AssertionError. I've indicated in comments the places where actual behavior differs from the spec. """ +from heat.common import context + class FakeClient(object): diff --git a/heat/tests/test_api_openstack_v1_util.py b/heat/tests/test_api_openstack_v1_util.py index fa143debe..97dfea149 100644 --- a/heat/tests/test_api_openstack_v1_util.py +++ b/heat/tests/test_api_openstack_v1_util.py @@ -12,7 +12,6 @@ # under the License. import mock - from webob import exc from heat.api.openstack.v1 import util diff --git a/heat/tests/test_api_openstack_v1_views_views_common.py b/heat/tests/test_api_openstack_v1_views_views_common.py index 46eb0db3a..aad425e0a 100644 --- a/heat/tests/test_api_openstack_v1_views_views_common.py +++ b/heat/tests/test_api_openstack_v1_views_views_common.py @@ -12,7 +12,6 @@ # under the License. import mock - from six.moves.urllib import parse as urlparse from heat.api.openstack.v1.views import views_common diff --git a/heat/tests/test_clients.py b/heat/tests/test_clients.py index 413c2a15d..ae73791d3 100644 --- a/heat/tests/test_clients.py +++ b/heat/tests/test_clients.py @@ -13,11 +13,12 @@ import mock -from heat.engine import clients -from heat.tests.common import HeatTestCase from heatclient import client as heatclient from keystoneclient import exceptions as keystone_exceptions +from heat.engine import clients +from heat.tests.common import HeatTestCase + class ClientsTest(HeatTestCase): diff --git a/heat/tests/test_cloud_config.py b/heat/tests/test_cloud_config.py index 5ad66bf82..8f8ed2b9f 100644 --- a/heat/tests/test_cloud_config.py +++ b/heat/tests/test_cloud_config.py @@ -14,10 +14,8 @@ import mock from heat.engine import parser +from heat.engine.resources.software_config import cloud_config as cc from heat.engine import template - -import heat.engine.resources.software_config.cloud_config as cc - from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/test_common_serializers.py b/heat/tests/test_common_serializers.py index 9c03b0c59..1663edda3 100644 --- a/heat/tests/test_common_serializers.py +++ b/heat/tests/test_common_serializers.py @@ -15,6 +15,7 @@ # under the License. import datetime + import webob from heat.common import serializers diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index a1a66a5aa..95e37320c 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -27,7 +27,7 @@ from heat.common import exception from heat.common import identifier from heat.common import template_format from heat.common import urlfetch -import heat.db.api as db_api +from heat.db import api as db_api from heat.engine import clients from heat.engine import dependencies from heat.engine import environment @@ -42,7 +42,7 @@ from heat.engine import watchrule from heat.openstack.common.rpc import common as rpc_common from heat.openstack.common.rpc import proxy from heat.openstack.common import threadgroup -import heat.rpc.api as engine_api +from heat.rpc import api as engine_api from heat.tests.common import HeatTestCase from heat.tests import fakes as test_fakes from heat.tests import generic_resource as generic_rsrc diff --git a/heat/tests/test_fault_middleware.py b/heat/tests/test_fault_middleware.py index cb5dbbf97..59c9b7ab1 100644 --- a/heat/tests/test_fault_middleware.py +++ b/heat/tests/test_fault_middleware.py @@ -11,14 +11,13 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.config import cfg import six +import heat.api.middleware.fault as fault from heat.common import exception as heat_exc from heat.openstack.common.rpc import common as rpc_common from heat.tests.common import HeatTestCase -from oslo.config import cfg - -import heat.api.middleware.fault as fault class StackNotFoundChild(heat_exc.StackNotFound): diff --git a/heat/tests/test_function.py b/heat/tests/test_function.py index 4a2d8f8e9..0efca3a76 100644 --- a/heat/tests/test_function.py +++ b/heat/tests/test_function.py @@ -13,9 +13,8 @@ import copy -from heat.tests.common import HeatTestCase - from heat.engine import function +from heat.tests.common import HeatTestCase class TestFunction(function.Function): diff --git a/heat/tests/test_heatclient.py b/heat/tests/test_heatclient.py index 167a02b57..c2e63bf05 100644 --- a/heat/tests/test_heatclient.py +++ b/heat/tests/test_heatclient.py @@ -14,20 +14,19 @@ import json import uuid -from oslo.config import cfg - -cfg.CONF.import_opt('region_name_for_services', 'heat.common.config') -cfg.CONF.import_group('keystone_authtoken', - 'keystoneclient.middleware.auth_token') - import keystoneclient.exceptions as kc_exception from keystoneclient.v3 import client as kc_v3 +from oslo.config import cfg from heat.common import exception from heat.common import heat_keystoneclient from heat.tests.common import HeatTestCase from heat.tests import utils +cfg.CONF.import_opt('region_name_for_services', 'heat.common.config') +cfg.CONF.import_group('keystone_authtoken', + 'keystoneclient.middleware.auth_token') + class KeystoneClientTest(HeatTestCase): """Test cases for heat.common.heat_keystoneclient.""" diff --git a/heat/tests/test_image.py b/heat/tests/test_image.py index c7536f7e1..73aab09be 100644 --- a/heat/tests/test_image.py +++ b/heat/tests/test_image.py @@ -16,7 +16,6 @@ from heat.common import exception from heat.engine import clients from heat.engine.resources import image from heat.engine.resources import nova_utils - from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_multi_part.py b/heat/tests/test_multi_part.py index 778177ec2..63f07807a 100644 --- a/heat/tests/test_multi_part.py +++ b/heat/tests/test_multi_part.py @@ -12,16 +12,15 @@ # under the License. import email + +import heatclient.exc as exc import mock from heat.engine import parser +from heat.engine.resources.software_config import multi_part as mp from heat.engine import template - -import heat.engine.resources.software_config.multi_part as mp - from heat.tests.common import HeatTestCase from heat.tests import utils -import heatclient.exc as exc class MultipartMimeTest(HeatTestCase): diff --git a/heat/tests/test_nested_stack.py b/heat/tests/test_nested_stack.py index 04a3687ef..33a02ba66 100644 --- a/heat/tests/test_nested_stack.py +++ b/heat/tests/test_nested_stack.py @@ -14,12 +14,10 @@ import copy import json + import mock -from requests import exceptions - from oslo.config import cfg - -cfg.CONF.import_opt('max_resources_per_stack', 'heat.common.config') +from requests import exceptions from heat.common import exception from heat.common import template_format @@ -32,6 +30,8 @@ from heat.tests.common import HeatTestCase from heat.tests import generic_resource as generic_rsrc from heat.tests import utils +cfg.CONF.import_opt('max_resources_per_stack', 'heat.common.config') + class NestedStackTest(HeatTestCase): test_template = ''' diff --git a/heat/tests/test_neutron_network_gateway.py b/heat/tests/test_neutron_network_gateway.py index 423a5d990..d0d827223 100644 --- a/heat/tests/test_neutron_network_gateway.py +++ b/heat/tests/test_neutron_network_gateway.py @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mox import IgnoreArg import mox +from mox import IgnoreArg from testtools import skipIf from heat.common import exception diff --git a/heat/tests/test_neutron_vpnservice.py b/heat/tests/test_neutron_vpnservice.py index b0b1abe2e..8425fe3cf 100644 --- a/heat/tests/test_neutron_vpnservice.py +++ b/heat/tests/test_neutron_vpnservice.py @@ -19,8 +19,8 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format from heat.engine import clients -from heat.engine.resources.neutron import vpnservice from heat.engine.resources.neutron import neutron_utils +from heat.engine.resources.neutron import vpnservice from heat.engine import scheduler from heat.openstack.common.importutils import try_import from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_notifications.py b/heat/tests/test_notifications.py index b1d2d810d..56fb50f50 100644 --- a/heat/tests/test_notifications.py +++ b/heat/tests/test_notifications.py @@ -14,7 +14,6 @@ import mock from oslo.config import cfg - from heat.common import exception from heat.common import template_format from heat.engine import environment diff --git a/heat/tests/test_nova_utils.py b/heat/tests/test_nova_utils.py index 456475829..7512baa11 100644 --- a/heat/tests/test_nova_utils.py +++ b/heat/tests/test_nova_utils.py @@ -12,9 +12,9 @@ # under the License. """Tests for :module:'heat.engine.resources.nova_utls'.""" -import mock import uuid +import mock from novaclient import exceptions as nova_exceptions from heat.common import exception diff --git a/heat/tests/test_plugin_manager.py b/heat/tests/test_plugin_manager.py index 1b19d61e1..ea435b789 100644 --- a/heat/tests/test_plugin_manager.py +++ b/heat/tests/test_plugin_manager.py @@ -15,9 +15,8 @@ import sys import types -from heat.tests.common import HeatTestCase - from heat.engine import plugin_manager +from heat.tests.common import HeatTestCase def legacy_test_mapping(): diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py index 327e3790c..2dda18322 100644 --- a/heat/tests/test_provider_template.py +++ b/heat/tests/test_provider_template.py @@ -19,14 +19,12 @@ import yaml from heat.common import exception from heat.common import template_format from heat.common import urlfetch - from heat.engine import environment from heat.engine import parser from heat.engine import properties from heat.engine import resource from heat.engine import resources from heat.engine.resources import template_resource - from heat.tests.common import HeatTestCase from heat.tests import generic_resource as generic_rsrc from heat.tests import utils diff --git a/heat/tests/test_random_string.py b/heat/tests/test_random_string.py index b00d58be0..99265365b 100644 --- a/heat/tests/test_random_string.py +++ b/heat/tests/test_random_string.py @@ -18,7 +18,6 @@ from heat.common import exception from heat.common import template_format from heat.engine import parser from heat.engine.resources.random_string import RandomString - from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index df42d2bbd..139f4ebfb 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -18,7 +18,7 @@ import uuid import mock from heat.common import exception -import heat.db.api as db_api +from heat.db import api as db_api from heat.engine import dependencies from heat.engine import environment from heat.engine import parser @@ -26,7 +26,6 @@ from heat.engine import resource from heat.engine import scheduler from heat.engine import template from heat.openstack.common.gettextutils import _ - from heat.tests.common import HeatTestCase from heat.tests import generic_resource as generic_rsrc from heat.tests import utils diff --git a/heat/tests/test_restarter.py b/heat/tests/test_restarter.py index 291d0bcd4..3408fe547 100644 --- a/heat/tests/test_restarter.py +++ b/heat/tests/test_restarter.py @@ -16,7 +16,6 @@ import mock from heat.common import template_format from heat.engine.resources import instance from heat.engine import scheduler - from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_scheduler.py b/heat/tests/test_scheduler.py index cef253477..8733238fb 100644 --- a/heat/tests/test_scheduler.py +++ b/heat/tests/test_scheduler.py @@ -11,14 +11,13 @@ # License for the specific language governing permissions and limitations # under the License. -import mox - import contextlib + import eventlet +import mox from heat.engine import dependencies from heat.engine import scheduler - from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_short_id.py b/heat/tests/test_short_id.py index 219b72b51..0cb74704a 100644 --- a/heat/tests/test_short_id.py +++ b/heat/tests/test_short_id.py @@ -11,11 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. +import uuid import testtools from heat.common import short_id -import uuid class ShortIdTest(testtools.TestCase): diff --git a/heat/tests/test_signal.py b/heat/tests/test_signal.py index d9e71b0b1..2f6ec2b61 100644 --- a/heat/tests/test_signal.py +++ b/heat/tests/test_signal.py @@ -18,15 +18,12 @@ from oslo.config import cfg from heat.common import exception from heat.common import template_format - from heat.db import api as db_api - from heat.engine import clients from heat.engine import parser from heat.engine import resource from heat.engine import scheduler from heat.engine import stack_user - from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import generic_resource diff --git a/heat/tests/test_software_config.py b/heat/tests/test_software_config.py index f3d753f85..cb6d0faba 100644 --- a/heat/tests/test_software_config.py +++ b/heat/tests/test_software_config.py @@ -11,15 +11,13 @@ # License for the specific language governing permissions and limitations # under the License. +from heatclient.exc import HTTPNotFound import mock from heat.common import exception from heat.engine import parser +from heat.engine.resources.software_config import software_config as sc from heat.engine import template - -import heat.engine.resources.software_config.software_config as sc -from heatclient.exc import HTTPNotFound - from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/test_sqlalchemy_api.py b/heat/tests/test_sqlalchemy_api.py index 29415a6b8..6ae439240 100644 --- a/heat/tests/test_sqlalchemy_api.py +++ b/heat/tests/test_sqlalchemy_api.py @@ -13,11 +13,11 @@ from datetime import datetime from datetime import timedelta +from json import dumps +from json import loads import uuid import fixtures -from json import dumps -from json import loads import mock import mox diff --git a/heat/tests/test_ssl_middleware.py b/heat/tests/test_ssl_middleware.py index 1a05e1497..c60ab6cb1 100644 --- a/heat/tests/test_ssl_middleware.py +++ b/heat/tests/test_ssl_middleware.py @@ -11,11 +11,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.config import cfg import webob from heat.api.middleware import ssl -from oslo.config import cfg - from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_support.py b/heat/tests/test_support.py index 6b8e46ff4..287630a9a 100644 --- a/heat/tests/test_support.py +++ b/heat/tests/test_support.py @@ -12,7 +12,6 @@ # under the License. from heat.engine import support - from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_template_format.py b/heat/tests/test_template_format.py index 031874066..0f39b5a69 100644 --- a/heat/tests/test_template_format.py +++ b/heat/tests/test_template_format.py @@ -14,9 +14,9 @@ import os import mock +import six import testtools import yaml -import six from heat.common import config from heat.common import exception diff --git a/heat/tests/test_version_negotiation_middleware.py b/heat/tests/test_version_negotiation_middleware.py index c873843ec..f14f1f57c 100644 --- a/heat/tests/test_version_negotiation_middleware.py +++ b/heat/tests/test_version_negotiation_middleware.py @@ -13,9 +13,8 @@ import webob -from heat.tests.common import HeatTestCase - from heat.api.middleware.version_negotiation import VersionNegotiationFilter +from heat.tests.common import HeatTestCase class VersionController(object): diff --git a/heat/tests/test_waitcondition.py b/heat/tests/test_waitcondition.py index 5315e94ca..fcc03fd0c 100644 --- a/heat/tests/test_waitcondition.py +++ b/heat/tests/test_waitcondition.py @@ -21,7 +21,7 @@ from oslo.config import cfg from heat.common import identifier from heat.common import template_format -import heat.db.api as db_api +from heat.db import api as db_api from heat.engine import environment from heat.engine import parser from heat.engine import resource diff --git a/heat/tests/test_watch.py b/heat/tests/test_watch.py index 2c3a2f396..769c30e9b 100644 --- a/heat/tests/test_watch.py +++ b/heat/tests/test_watch.py @@ -17,7 +17,7 @@ import datetime import mox from heat.common import exception -import heat.db.api as db_api +from heat.db import api as db_api from heat.engine import parser from heat.engine import watchrule from heat.openstack.common import timeutils diff --git a/heat/tests/test_wsgi.py b/heat/tests/test_wsgi.py index c458839e6..9a3704fdc 100644 --- a/heat/tests/test_wsgi.py +++ b/heat/tests/test_wsgi.py @@ -16,6 +16,7 @@ import json + from oslo.config import cfg import stubout import webob diff --git a/heat/tests/v1_1/fakes.py b/heat/tests/v1_1/fakes.py index a457eb517..14ede6062 100644 --- a/heat/tests/v1_1/fakes.py +++ b/heat/tests/v1_1/fakes.py @@ -16,11 +16,10 @@ import httplib2 -from six.moves.urllib import parse as urlparse - from novaclient import client as base_client from novaclient import exceptions as nova_exceptions from novaclient.v1_1 import client +from six.moves.urllib import parse as urlparse from heat.tests import fakes diff --git a/tox.ini b/tox.ini index 16d24d29f..e2098eb0a 100644 --- a/tox.ini +++ b/tox.ini @@ -40,9 +40,9 @@ commands = python setup.py build_sphinx [flake8] # H201 no 'except:' at least use 'except Exception:' # H302 import only modules.'bla..' does not import a module -# H306 imports not in alphabetical order # H404 multi line docstring should start with a summary -ignore = H201,H302,H306,H404,H803 +# H803 no full stop at the end of the commit message +ignore = H201,H302,H404,H803 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build