From 506d6940b19baa00aef44a9d108dc2d01c8d0e2f Mon Sep 17 00:00:00 2001 From: Pavlo Shchelokovskyy Date: Thu, 6 Feb 2014 14:17:21 +0200 Subject: [PATCH] Order imports in alphabetical order (8/9) This patch is one in a series to re-enable H306 style check rule (imports are in alphabetical order). It touches second half of tests (starting from test_n*). Implements: blueprint reduce-flake8-ignored-rules (partial) Change-Id: I5561d90a67eb5dc882200d432fda6b162011ac41 --- heat/tests/test_nested_stack.py | 2 +- heat/tests/test_neutron.py | 12 ++++++------ heat/tests/test_neutron_autoscaling.py | 5 +++-- heat/tests/test_neutron_firewall.py | 4 ++-- heat/tests/test_neutron_loadbalancer.py | 4 ++-- heat/tests/test_neutron_metering.py | 4 ++-- heat/tests/test_neutron_network_gateway.py | 6 +++--- heat/tests/test_neutron_security_group.py | 12 ++++++------ heat/tests/test_neutron_vpnservice.py | 4 ++-- heat/tests/test_nokey.py | 6 +++--- heat/tests/test_notifications.py | 14 +++++--------- heat/tests/test_nova_floatingip.py | 6 +++--- heat/tests/test_nova_keypair.py | 4 ++-- heat/tests/test_os_database.py | 4 ++-- heat/tests/test_parameters.py | 4 ++-- heat/tests/test_parser.py | 17 +++++++---------- heat/tests/test_plugin_loader.py | 3 ++- heat/tests/test_properties.py | 4 ++-- heat/tests/test_provider_template.py | 6 +++--- heat/tests/test_random_string.py | 5 ++--- heat/tests/test_resource.py | 8 ++++---- heat/tests/test_resource_group.py | 2 +- heat/tests/test_restarter.py | 4 ++-- heat/tests/test_rpc_client.py | 2 +- heat/tests/test_s3.py | 8 ++++---- heat/tests/test_scaling_template.py | 3 +-- heat/tests/test_security_group.py | 13 +++++++------ heat/tests/test_server.py | 17 +++++++++-------- heat/tests/test_server_tags.py | 9 +++++---- heat/tests/test_signal.py | 11 +++++------ heat/tests/test_software_deployment.py | 5 ++--- heat/tests/test_sqlalchemy_api.py | 17 ++++++++--------- heat/tests/test_sqlalchemy_types.py | 10 +++++----- heat/tests/test_stack_lock.py | 4 ++-- heat/tests/test_stack_resource.py | 7 ++++--- heat/tests/test_stack_user.py | 13 +++++-------- heat/tests/test_structured_config.py | 3 +-- heat/tests/test_swift.py | 5 ++--- heat/tests/test_template.py | 6 ++---- heat/tests/test_template_format.py | 5 +++-- heat/tests/test_urlfetch.py | 6 ++---- heat/tests/test_user.py | 2 +- heat/tests/test_validate.py | 10 +++++----- heat/tests/test_volume.py | 12 +++++------- heat/tests/test_vpc.py | 2 +- heat/tests/test_waitcondition.py | 17 ++++++++--------- heat/tests/test_watch.py | 7 ++++--- heat/tests/utils.py | 6 ++---- 48 files changed, 161 insertions(+), 179 deletions(-) diff --git a/heat/tests/test_nested_stack.py b/heat/tests/test_nested_stack.py index a555e9dd31..a8c14c9dce 100644 --- a/heat/tests/test_nested_stack.py +++ b/heat/tests/test_nested_stack.py @@ -28,9 +28,9 @@ from heat.db import api as db_api from heat.engine import parser from heat.engine import resource from heat.engine import scheduler +from heat.tests.common import HeatTestCase from heat.tests import generic_resource as generic_rsrc from heat.tests import utils -from heat.tests.common import HeatTestCase class NestedStackTest(HeatTestCase): diff --git a/heat/tests/test_neutron.py b/heat/tests/test_neutron.py index 565a2fe9ad..0f3777e755 100644 --- a/heat/tests/test_neutron.py +++ b/heat/tests/test_neutron.py @@ -12,21 +12,21 @@ # under the License. import copy -import mox +import mox from testtools import skipIf -from heat.engine import clients from heat.common import exception from heat.common import template_format +from heat.engine import clients from heat.engine import properties from heat.engine import resource -from heat.engine import scheduler from heat.engine.resources.neutron import net -from heat.engine.resources.neutron import provider_net -from heat.engine.resources.neutron import subnet -from heat.engine.resources.neutron import router from heat.engine.resources.neutron.neutron import NeutronResource as qr +from heat.engine.resources.neutron import provider_net +from heat.engine.resources.neutron import router +from heat.engine.resources.neutron import subnet +from heat.engine import scheduler from heat.openstack.common.importutils import try_import from heat.tests.common import HeatTestCase from heat.tests import fakes diff --git a/heat/tests/test_neutron_autoscaling.py b/heat/tests/test_neutron_autoscaling.py index 470fff12e8..470b30826d 100644 --- a/heat/tests/test_neutron_autoscaling.py +++ b/heat/tests/test_neutron_autoscaling.py @@ -12,10 +12,11 @@ # under the License. import copy -from testtools import skipIf +import uuid + import mox from oslo.config import cfg -import uuid +from testtools import skipIf from heat.common import template_format from heat.db import api as db_api diff --git a/heat/tests/test_neutron_firewall.py b/heat/tests/test_neutron_firewall.py index ccea8a3496..4fa4b53a0b 100644 --- a/heat/tests/test_neutron_firewall.py +++ b/heat/tests/test_neutron_firewall.py @@ -18,12 +18,12 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format from heat.engine import clients -from heat.engine import scheduler from heat.engine.resources.neutron import firewall +from heat.engine import scheduler from heat.openstack.common.importutils import try_import +from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import utils -from heat.tests.common import HeatTestCase neutronclient = try_import('neutronclient.v2_0.client') diff --git a/heat/tests/test_neutron_loadbalancer.py b/heat/tests/test_neutron_loadbalancer.py index 9a872de6c1..beb6eea7be 100644 --- a/heat/tests/test_neutron_loadbalancer.py +++ b/heat/tests/test_neutron_loadbalancer.py @@ -19,12 +19,12 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format from heat.engine import clients -from heat.engine import scheduler from heat.engine.resources.neutron import loadbalancer +from heat.engine import scheduler from heat.openstack.common.importutils import try_import +from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import utils -from heat.tests.common import HeatTestCase from heat.tests.v1_1 import fakes as nova_fakes neutronclient = try_import('neutronclient.v2_0.client') diff --git a/heat/tests/test_neutron_metering.py b/heat/tests/test_neutron_metering.py index 1df342ccdc..810b3a28b4 100644 --- a/heat/tests/test_neutron_metering.py +++ b/heat/tests/test_neutron_metering.py @@ -15,12 +15,12 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format from heat.engine import clients -from heat.engine import scheduler from heat.engine.resources.neutron import metering +from heat.engine import scheduler from heat.openstack.common.importutils import try_import +from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import utils -from heat.tests.common import HeatTestCase neutronclient = try_import('neutronclient.v2_0.client') diff --git a/heat/tests/test_neutron_network_gateway.py b/heat/tests/test_neutron_network_gateway.py index 158433a8db..62af8da54c 100644 --- a/heat/tests/test_neutron_network_gateway.py +++ b/heat/tests/test_neutron_network_gateway.py @@ -14,18 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +from mox import IgnoreArg from testtools import skipIf from heat.common import exception from heat.common import template_format from heat.engine import clients -from heat.engine import scheduler from heat.engine.resources.neutron import network_gateway +from heat.engine import scheduler from heat.openstack.common.importutils import try_import +from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import utils -from heat.tests.common import HeatTestCase -from mox import IgnoreArg neutronclient = try_import('neutronclient.v2_0.client') neutronV20 = try_import('neutronclient.neutron.v2_0') diff --git a/heat/tests/test_neutron_security_group.py b/heat/tests/test_neutron_security_group.py index 216f887645..dd4b3e61e2 100644 --- a/heat/tests/test_neutron_security_group.py +++ b/heat/tests/test_neutron_security_group.py @@ -11,6 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. +from neutronclient.common.exceptions import NeutronClientException +from neutronclient.v2_0 import client as neutronclient +from novaclient.v1_1 import security_group_rules as nova_sgr +from novaclient.v1_1 import security_groups as nova_sg + from heat.common import exception from heat.common import template_format from heat.engine import clients @@ -18,13 +23,8 @@ from heat.engine import parser from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests.fakes import FakeKeystoneClient -from heat.tests.v1_1 import fakes from heat.tests import utils - -from novaclient.v1_1 import security_groups as nova_sg -from novaclient.v1_1 import security_group_rules as nova_sgr -from neutronclient.common.exceptions import NeutronClientException -from neutronclient.v2_0 import client as neutronclient +from heat.tests.v1_1 import fakes class SecurityGroupTest(HeatTestCase): diff --git a/heat/tests/test_neutron_vpnservice.py b/heat/tests/test_neutron_vpnservice.py index a023c457e4..e6f982e6cf 100644 --- a/heat/tests/test_neutron_vpnservice.py +++ b/heat/tests/test_neutron_vpnservice.py @@ -18,12 +18,12 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format from heat.engine import clients -from heat.engine import scheduler 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 from heat.tests import fakes from heat.tests import utils -from heat.tests.common import HeatTestCase neutronclient = try_import('neutronclient.v2_0.client') diff --git a/heat/tests/test_nokey.py b/heat/tests/test_nokey.py index 36d970e87e..36ff57d9ef 100644 --- a/heat/tests/test_nokey.py +++ b/heat/tests/test_nokey.py @@ -11,14 +11,14 @@ # License for the specific language governing permissions and limitations # under the License. -from heat.tests.v1_1 import fakes -from heat.engine.resources import instance as instances -from heat.engine.resources import nova_utils from heat.common import template_format from heat.engine import clients +from heat.engine.resources import instance as instances +from heat.engine.resources import nova_utils from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests import utils +from heat.tests.v1_1 import fakes nokey_template = ''' diff --git a/heat/tests/test_notifications.py b/heat/tests/test_notifications.py index 10ead81981..887ad4abd6 100644 --- a/heat/tests/test_notifications.py +++ b/heat/tests/test_notifications.py @@ -11,20 +11,15 @@ # under the License. import mock - from oslo.config import cfg -from heat.openstack.common import timeutils from heat.common import exception from heat.common import template_format from heat.engine import environment from heat.engine import parser from heat.engine import resource - # imports for mocking -from heat.engine import signal_responder as signal -from heat.engine import stack_resource from heat.engine.resources import autoscaling from heat.engine.resources import image from heat.engine.resources import instance @@ -32,13 +27,14 @@ from heat.engine.resources import loadbalancer from heat.engine.resources import nova_keypair from heat.engine.resources import user from heat.engine.resources import wait_condition as waitc - -from heat.tests import generic_resource -from heat.tests import utils +from heat.engine import signal_responder as signal +from heat.engine import stack_resource +from heat.openstack.common import timeutils from heat.tests import common - +from heat.tests import generic_resource # reuse the same template than autoscaling tests from heat.tests.test_autoscaling import as_template +from heat.tests import utils class NotificationTest(common.HeatTestCase): diff --git a/heat/tests/test_nova_floatingip.py b/heat/tests/test_nova_floatingip.py index 97528b8fd9..9f5b67b88b 100644 --- a/heat/tests/test_nova_floatingip.py +++ b/heat/tests/test_nova_floatingip.py @@ -10,16 +10,16 @@ # License for the specific language governing permissions and limitations # under the License. +from novaclient.v1_1 import client as novaclient + from heat.common import template_format +from heat.engine import clients from heat.engine.resources.nova_floatingip import NovaFloatingIp from heat.engine.resources.nova_floatingip import NovaFloatingIpAssociation -from heat.engine import clients from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests import utils -from novaclient.v1_1 import client as novaclient - floating_ip_template = ''' { diff --git a/heat/tests/test_nova_keypair.py b/heat/tests/test_nova_keypair.py index b04b9d4a96..6313731b20 100644 --- a/heat/tests/test_nova_keypair.py +++ b/heat/tests/test_nova_keypair.py @@ -17,11 +17,11 @@ import copy from novaclient import exceptions as nova_exceptions from heat.engine import clients -from heat.engine import scheduler from heat.engine.resources import nova_keypair +from heat.engine import scheduler from heat.tests.common import HeatTestCase -from heat.tests.v1_1 import fakes from heat.tests import utils +from heat.tests.v1_1 import fakes class NovaKeyPairTest(HeatTestCase): diff --git a/heat/tests/test_os_database.py b/heat/tests/test_os_database.py index 8c63df8496..b773a1b465 100644 --- a/heat/tests/test_os_database.py +++ b/heat/tests/test_os_database.py @@ -15,11 +15,11 @@ import uuid from heat.common import exception from heat.common import template_format +from heat.engine.clients import troveclient from heat.engine import environment from heat.engine import parser -from heat.engine import scheduler -from heat.engine.clients import troveclient from heat.engine.resources import os_database +from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/test_parameters.py b/heat/tests/test_parameters.py index b2ae542a8b..3c3fc91356 100644 --- a/heat/tests/test_parameters.py +++ b/heat/tests/test_parameters.py @@ -11,15 +11,15 @@ # License for the specific language governing permissions and limitations # under the License. +import json import testtools -import json from heat.common import exception from heat.common import identifier +from heat.engine import constraints as constr from heat.engine import parameters from heat.engine import template -from heat.engine import constraints as constr class ParameterTest(testtools.TestCase): diff --git a/heat/tests/test_parser.py b/heat/tests/test_parser.py index f4ae35d641..c14e6abd72 100644 --- a/heat/tests/test_parser.py +++ b/heat/tests/test_parser.py @@ -12,35 +12,32 @@ # under the License. import json -import mock import time from keystoneclient import exceptions as kc_exceptions +import mock from mox import IgnoreArg from oslo.config import cfg from six.moves import xrange -from heat.engine import environment from heat.common import exception from heat.common import template_format from heat.common import urlfetch +import heat.db.api as db_api +import heat.engine.cfn.functions from heat.engine import clients +from heat.engine import environment from heat.engine import function -from heat.engine import resource from heat.engine import parameters from heat.engine import parser +from heat.engine import resource from heat.engine import scheduler from heat.engine import template - -import heat.engine.cfn.functions - -from heat.tests.fakes import FakeKeystoneClient from heat.tests.common import HeatTestCase +from heat.tests.fakes import FakeKeystoneClient +from heat.tests import generic_resource as generic_rsrc from heat.tests import utils from heat.tests.v1_1 import fakes -from heat.tests import generic_resource as generic_rsrc - -import heat.db.api as db_api def join(raw): diff --git a/heat/tests/test_plugin_loader.py b/heat/tests/test_plugin_loader.py index 37e8dd6fb2..5a63e919d8 100644 --- a/heat/tests/test_plugin_loader.py +++ b/heat/tests/test_plugin_loader.py @@ -14,10 +14,11 @@ import pkgutil import sys + import testtools -import heat.engine from heat.common import plugin_loader +import heat.engine class PluginLoaderTest(testtools.TestCase): diff --git a/heat/tests/test_properties.py b/heat/tests/test_properties.py index 99f1abe230..4091d7a510 100644 --- a/heat/tests/test_properties.py +++ b/heat/tests/test_properties.py @@ -11,15 +11,15 @@ # License for the specific language governing permissions and limitations # under the License. +import testtools -from heat.engine import constraints from heat.common import exception +from heat.engine import constraints from heat.engine.hot import parameters as hot_param from heat.engine import parameters from heat.engine import properties from heat.engine import resources from heat.engine import support -import testtools class PropertySchemaTest(testtools.TestCase): diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py index 0c23640856..163b7ba37c 100644 --- a/heat/tests/test_provider_template.py +++ b/heat/tests/test_provider_template.py @@ -11,15 +11,15 @@ # License for the specific language governing permissions and limitations # under the License. +import json import os import uuid -import json import testscenarios from heat.common import exception -from heat.common import urlfetch from heat.common import template_format +from heat.common import urlfetch from heat.engine import environment from heat.engine import parser @@ -28,8 +28,8 @@ from heat.engine import resource from heat.engine import resources from heat.engine.resources import template_resource -from heat.tests import generic_resource as generic_rsrc 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 baa27a4ca7..5087a3cea2 100644 --- a/heat/tests/test_random_string.py +++ b/heat/tests/test_random_string.py @@ -11,6 +11,8 @@ # License for the specific language governing permissions and limitations # under the License. +from testtools.matchers import HasLength +from testtools.matchers import MatchesRegex from heat.common import exception from heat.common import template_format @@ -20,9 +22,6 @@ from heat.engine.resources.random_string import RandomString from heat.tests.common import HeatTestCase from heat.tests import utils -from testtools.matchers import MatchesRegex -from testtools.matchers import HasLength - class TestRandomString(HeatTestCase): diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index f7e4714e4e..a788a3bdce 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -11,24 +11,24 @@ # License for the specific language governing permissions and limitations # under the License. -import json import itertools +import json import uuid import mock from heat.common import exception +import heat.db.api as db_api from heat.engine import dependencies +from heat.engine import environment from heat.engine import parser from heat.engine import resource from heat.engine import scheduler from heat.engine import template -from heat.engine import environment from heat.openstack.common.gettextutils import _ -import heat.db.api as db_api -from heat.tests import generic_resource as generic_rsrc 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_resource_group.py b/heat/tests/test_resource_group.py index 2eb8b48b08..0061a179cc 100644 --- a/heat/tests/test_resource_group.py +++ b/heat/tests/test_resource_group.py @@ -17,8 +17,8 @@ import mock from heat.common import exception from heat.engine import resource -from heat.engine import scheduler from heat.engine.resources import resource_group +from heat.engine import scheduler from heat.tests import common from heat.tests import generic_resource from heat.tests import utils diff --git a/heat/tests/test_restarter.py b/heat/tests/test_restarter.py index 5a64e8f37b..ea34f13313 100644 --- a/heat/tests/test_restarter.py +++ b/heat/tests/test_restarter.py @@ -13,11 +13,11 @@ import mock from heat.common import template_format -from heat.engine import scheduler from heat.engine.resources import instance +from heat.engine import scheduler -from heat.tests import utils from heat.tests import common +from heat.tests import utils restarter_template = ''' diff --git a/heat/tests/test_rpc_client.py b/heat/tests/test_rpc_client.py index 83480d3b2f..12effa6d1b 100644 --- a/heat/tests/test_rpc_client.py +++ b/heat/tests/test_rpc_client.py @@ -24,9 +24,9 @@ import stubout import testtools from heat.common import identifier +from heat.openstack.common import rpc from heat.rpc import api as rpc_api from heat.rpc import client as rpc_client -from heat.openstack.common import rpc from heat.tests import utils diff --git a/heat/tests/test_s3.py b/heat/tests/test_s3.py index 3b72881afc..35e1f97cc6 100644 --- a/heat/tests/test_s3.py +++ b/heat/tests/test_s3.py @@ -16,14 +16,14 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format -from heat.openstack.common.importutils import try_import -from heat.engine.resources import s3 -from heat.engine import resource from heat.engine import clients +from heat.engine import resource +from heat.engine.resources import s3 from heat.engine import scheduler +from heat.openstack.common.importutils import try_import from heat.tests.common import HeatTestCase -from heat.tests import utils from heat.tests import fakes +from heat.tests import utils swiftclient = try_import('swiftclient.client') diff --git a/heat/tests/test_scaling_template.py b/heat/tests/test_scaling_template.py index a1957158b0..a5d2e61d3c 100644 --- a/heat/tests/test_scaling_template.py +++ b/heat/tests/test_scaling_template.py @@ -12,9 +12,8 @@ import itertools -from heat.scaling import template from heat.common import short_id - +from heat.scaling import template from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_security_group.py b/heat/tests/test_security_group.py index ca37cec62d..28f403cf5a 100644 --- a/heat/tests/test_security_group.py +++ b/heat/tests/test_security_group.py @@ -13,21 +13,22 @@ import collections -from heat.engine import clients +from neutronclient.common.exceptions import NeutronClientException +from neutronclient.v2_0 import client as neutronclient +from novaclient.v1_1 import security_group_rules as nova_sgr +from novaclient.v1_1 import security_groups as nova_sg + from heat.common import exception from heat.common import template_format +from heat.engine import clients from heat.engine import parser from heat.engine import resource from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests.fakes import FakeKeystoneClient -from heat.tests.v1_1 import fakes from heat.tests import utils +from heat.tests.v1_1 import fakes -from novaclient.v1_1 import security_groups as nova_sg -from novaclient.v1_1 import security_group_rules as nova_sgr -from neutronclient.common.exceptions import NeutronClientException -from neutronclient.v2_0 import client as neutronclient NovaSG = collections.namedtuple('NovaSG', ' '.join([ diff --git a/heat/tests/test_server.py b/heat/tests/test_server.py index 550ebe76fb..7f9fbd751b 100644 --- a/heat/tests/test_server.py +++ b/heat/tests/test_server.py @@ -13,28 +13,29 @@ import collections import copy -import mock -import mox import uuid -from heat.engine import environment -from heat.tests.v1_1 import fakes as fakes_v1_1 -from heat.tests import fakes +import mock +import mox +from novaclient import exceptions + from heat.common import exception from heat.common import template_format from heat.engine import clients +from heat.engine import environment from heat.engine import parser from heat.engine import resource -from heat.engine import scheduler from heat.engine.resources import image from heat.engine.resources import nova_utils from heat.engine.resources import server as servers from heat.engine.resources.software_config import software_config as sc -from heat.openstack.common import uuidutils +from heat.engine import scheduler from heat.openstack.common.gettextutils import _ +from heat.openstack.common import uuidutils from heat.tests.common import HeatTestCase +from heat.tests import fakes from heat.tests import utils -from novaclient import exceptions +from heat.tests.v1_1 import fakes as fakes_v1_1 wp_template = ''' diff --git a/heat/tests/test_server_tags.py b/heat/tests/test_server_tags.py index 00f61a1dac..58ab3ffd72 100644 --- a/heat/tests/test_server_tags.py +++ b/heat/tests/test_server_tags.py @@ -13,18 +13,19 @@ import copy import uuid + import mox -from heat.engine import environment -from heat.tests.v1_1 import fakes -from heat.engine.resources import instance as instances -from heat.engine.resources import nova_utils from heat.common import template_format from heat.engine import clients +from heat.engine import environment from heat.engine import parser +from heat.engine.resources import instance as instances +from heat.engine.resources import nova_utils from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests import utils +from heat.tests.v1_1 import fakes instance_template = ''' diff --git a/heat/tests/test_signal.py b/heat/tests/test_signal.py index ac6f82782e..090ab4e8bf 100644 --- a/heat/tests/test_signal.py +++ b/heat/tests/test_signal.py @@ -13,13 +13,9 @@ import datetime +from keystoneclient import exceptions as kc_exceptions from oslo.config import cfg -from heat.tests import generic_resource -from heat.tests import fakes -from heat.tests.common import HeatTestCase -from heat.tests import utils - from heat.common import exception from heat.common import template_format @@ -31,7 +27,10 @@ from heat.engine import resource from heat.engine import scheduler from heat.engine import stack_user -from keystoneclient import exceptions as kc_exceptions +from heat.tests.common import HeatTestCase +from heat.tests import fakes +from heat.tests import generic_resource +from heat.tests import utils test_template_signal = ''' diff --git a/heat/tests/test_software_deployment.py b/heat/tests/test_software_deployment.py index 288eddf347..ec58aabe04 100644 --- a/heat/tests/test_software_deployment.py +++ b/heat/tests/test_software_deployment.py @@ -11,14 +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 import template from heat.engine.resources.software_config import software_deployment as sd -from heatclient.exc import HTTPNotFound - +from heat.engine import template 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 e723f1c2eb..829ad228a9 100644 --- a/heat/tests/test_sqlalchemy_api.py +++ b/heat/tests/test_sqlalchemy_api.py @@ -10,34 +10,33 @@ # License for the specific language governing permissions and limitations # under the License. -import uuid from datetime import datetime from datetime import timedelta +import uuid import fixtures -from json import loads from json import dumps +from json import loads import mock import mox -from heat.db.sqlalchemy import api as db_api -from heat.engine import environment -from heat.tests.v1_1 import fakes -from heat.engine.resource import Resource from heat.common import context from heat.common import exception from heat.common import template_format -from heat.engine.resources import instance as instances +from heat.db.sqlalchemy import api as db_api from heat.engine import clients +from heat.engine.clients import novaclient +from heat.engine import environment from heat.engine import parser +from heat.engine.resource import Resource +from heat.engine.resources import instance as instances from heat.engine import scheduler from heat.openstack.common import timeutils from heat.tests.common import HeatTestCase from heat.tests import utils +from heat.tests.v1_1 import fakes -from heat.engine.clients import novaclient - wp_template = ''' { "AWSTemplateFormatVersion" : "2010-09-09", diff --git a/heat/tests/test_sqlalchemy_types.py b/heat/tests/test_sqlalchemy_types.py index 52e8ef6fa9..691fff0f22 100644 --- a/heat/tests/test_sqlalchemy_types.py +++ b/heat/tests/test_sqlalchemy_types.py @@ -11,13 +11,13 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools - -from heat.db.sqlalchemy.types import LongText -from heat.db.sqlalchemy.types import Json -from sqlalchemy import types from sqlalchemy.dialects.mysql.base import MySQLDialect from sqlalchemy.dialects.sqlite.base import SQLiteDialect +from sqlalchemy import types +import testtools + +from heat.db.sqlalchemy.types import Json +from heat.db.sqlalchemy.types import LongText class LongTextTest(testtools.TestCase): diff --git a/heat/tests/test_stack_lock.py b/heat/tests/test_stack_lock.py index 52d7ca1081..4a2458ec68 100644 --- a/heat/tests/test_stack_lock.py +++ b/heat/tests/test_stack_lock.py @@ -11,13 +11,13 @@ # License for the specific language governing permissions and limitations # under the License. +from heat.common import exception from heat.db import api as db_api from heat.engine import stack_lock -from heat.openstack.common.rpc import proxy from heat.openstack.common.rpc import common as rpc_common +from heat.openstack.common.rpc import proxy from heat.tests.common import HeatTestCase from heat.tests import utils -from heat.common import exception class StackLockTest(HeatTestCase): diff --git a/heat/tests/test_stack_resource.py b/heat/tests/test_stack_resource.py index 9c77d1b7bf..0a4cbe67c5 100644 --- a/heat/tests/test_stack_resource.py +++ b/heat/tests/test_stack_resource.py @@ -11,12 +11,13 @@ # License for the specific language governing permissions and limitations # under the License. -import mock -import mox import uuid -from heat.common import template_format +import mock +import mox + from heat.common import exception +from heat.common import template_format from heat.engine import environment from heat.engine import parser from heat.engine import resource diff --git a/heat/tests/test_stack_user.py b/heat/tests/test_stack_user.py index 0508fe7c17..bebba108fd 100644 --- a/heat/tests/test_stack_user.py +++ b/heat/tests/test_stack_user.py @@ -12,22 +12,19 @@ # License for the specific language governing permissions and limitations # under the License. -from heat.tests import fakes -from heat.tests import generic_resource -from heat.tests.common import HeatTestCase -from heat.tests import utils +from keystoneclient import exceptions as kc_exceptions from heat.common import exception from heat.common import short_id from heat.common import template_format - from heat.db import api as db_api - from heat.engine import resource from heat.engine import scheduler from heat.engine import stack_user - -from keystoneclient import exceptions as kc_exceptions +from heat.tests.common import HeatTestCase +from heat.tests import fakes +from heat.tests import generic_resource +from heat.tests import utils user_template = ''' diff --git a/heat/tests/test_structured_config.py b/heat/tests/test_structured_config.py index 8ba49a429d..49b67a2c17 100644 --- a/heat/tests/test_structured_config.py +++ b/heat/tests/test_structured_config.py @@ -14,9 +14,8 @@ import mock from heat.engine import parser +from heat.engine.resources.software_config import structured_config as sc from heat.engine import template -import heat.engine.resources.software_config.structured_config as sc - from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/test_swift.py b/heat/tests/test_swift.py index 088be5460f..726097755f 100644 --- a/heat/tests/test_swift.py +++ b/heat/tests/test_swift.py @@ -13,15 +13,14 @@ import mox - from testtools import skipIf from heat.common import template_format -from heat.openstack.common.importutils import try_import -from heat.engine.resources import swift from heat.engine import clients from heat.engine import resource +from heat.engine.resources import swift from heat.engine import scheduler +from heat.openstack.common.importutils import try_import from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import utils diff --git a/heat/tests/test_template.py b/heat/tests/test_template.py index f3d91c131f..a20d355e30 100644 --- a/heat/tests/test_template.py +++ b/heat/tests/test_template.py @@ -12,13 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -from heat.tests.common import HeatTestCase - from heat.common import exception - +from heat.engine.cfn.template import CfnTemplate from heat.engine import plugin_manager from heat.engine import template -from heat.engine.cfn.template import CfnTemplate +from heat.tests.common import HeatTestCase class TestTemplatePluginManager(HeatTestCase): diff --git a/heat/tests/test_template_format.py b/heat/tests/test_template_format.py index 45ea1a04ba..f444fae1d8 100644 --- a/heat/tests/test_template_format.py +++ b/heat/tests/test_template_format.py @@ -11,15 +11,16 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import os + +import mock import testtools import yaml -from heat.engine import clients from heat.common import config from heat.common import exception from heat.common import template_format +from heat.engine import clients from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/test_urlfetch.py b/heat/tests/test_urlfetch.py index f113b53b0d..3bec3a774e 100644 --- a/heat/tests/test_urlfetch.py +++ b/heat/tests/test_urlfetch.py @@ -12,16 +12,14 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.config import cfg import requests from requests import exceptions - -from oslo.config import cfg from six.moves import cStringIO from heat.common import urlfetch -from heat.tests.common import HeatTestCase - from heat.openstack.common.py3kcompat import urlutils +from heat.tests.common import HeatTestCase class Response: diff --git a/heat/tests/test_user.py b/heat/tests/test_user.py index 6d6e3e8d5b..fb8dbd4415 100644 --- a/heat/tests/test_user.py +++ b/heat/tests/test_user.py @@ -20,8 +20,8 @@ from heat.common import short_id from heat.common import template_format from heat.db import api as db_api from heat.engine import resource -from heat.engine import scheduler from heat.engine.resources import user +from heat.engine import scheduler from heat.tests.common import HeatTestCase from heat.tests import fakes from heat.tests import utils diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py index fdb2edee39..de093c006b 100644 --- a/heat/tests/test_validate.py +++ b/heat/tests/test_validate.py @@ -15,19 +15,19 @@ import collections from testtools import skipIf -from heat.engine import clients -from heat.engine import environment -from heat.tests.v1_1 import fakes from heat.common import exception from heat.common import template_format +from heat.engine import clients +from heat.engine import environment +from heat.engine.hot.template import HOTemplate +from heat.engine import parser from heat.engine import resources from heat.engine.resources import instance as instances from heat.engine import service from heat.openstack.common.importutils import try_import -from heat.engine import parser -from heat.engine.hot.template import HOTemplate from heat.tests.common import HeatTestCase from heat.tests import utils +from heat.tests.v1_1 import fakes test_template_volumeattach = ''' { diff --git a/heat/tests/test_volume.py b/heat/tests/test_volume.py index bcc7d7fb2b..de9b6d1c71 100644 --- a/heat/tests/test_volume.py +++ b/heat/tests/test_volume.py @@ -14,25 +14,23 @@ import json +from cinderclient.v1 import client as cinderclient import mox - from testtools import skipIf from heat.common import exception from heat.common import template_format -from heat.engine import scheduler +from heat.engine import clients +from heat.engine import resource from heat.engine.resources import image from heat.engine.resources import instance from heat.engine.resources import nova_utils from heat.engine.resources import volume as vol -from heat.engine import clients -from heat.engine import resource +from heat.engine import scheduler from heat.openstack.common.importutils import try_import from heat.tests.common import HeatTestCase -from heat.tests.v1_1 import fakes from heat.tests import utils - -from cinderclient.v1 import client as cinderclient +from heat.tests.v1_1 import fakes volume_backups = try_import('cinderclient.v1.volume_backups') diff --git a/heat/tests/test_vpc.py b/heat/tests/test_vpc.py index 2abd58b035..749b252604 100644 --- a/heat/tests/test_vpc.py +++ b/heat/tests/test_vpc.py @@ -15,8 +15,8 @@ from testtools import skipIf from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine import clients +from heat.engine import parser from heat.engine import resource from heat.engine import scheduler from heat.tests.common import HeatTestCase diff --git a/heat/tests/test_waitcondition.py b/heat/tests/test_waitcondition.py index 2e690387f5..7a72f384dc 100644 --- a/heat/tests/test_waitcondition.py +++ b/heat/tests/test_waitcondition.py @@ -12,25 +12,24 @@ # under the License. import datetime -import uuid import json -import mox import time +import uuid +import mox from oslo.config import cfg -from heat.tests.common import HeatTestCase -from heat.tests import fakes -from heat.tests import utils - -import heat.db.api as db_api -from heat.common import template_format from heat.common import identifier +from heat.common import template_format +import heat.db.api as db_api from heat.engine import environment from heat.engine import parser from heat.engine import resource -from heat.engine import scheduler from heat.engine.resources import wait_condition as wc +from heat.engine import scheduler +from heat.tests.common import HeatTestCase +from heat.tests import fakes +from heat.tests import utils test_template_waitcondition = ''' { diff --git a/heat/tests/test_watch.py b/heat/tests/test_watch.py index bc1c4d7cef..99a76f49a4 100644 --- a/heat/tests/test_watch.py +++ b/heat/tests/test_watch.py @@ -13,13 +13,14 @@ import datetime + import mox -import heat.db.api as db_api from heat.common import exception -from heat.openstack.common import timeutils -from heat.engine import watchrule +import heat.db.api as db_api from heat.engine import parser +from heat.engine import watchrule +from heat.openstack.common import timeutils from heat.tests.common import HeatTestCase from heat.tests import utils diff --git a/heat/tests/utils.py b/heat/tests/utils.py index 0b5f42e5f4..6a5e3786b7 100644 --- a/heat/tests/utils.py +++ b/heat/tests/utils.py @@ -17,17 +17,15 @@ import string import sys import uuid -import sqlalchemy - from oslo.config import cfg +import sqlalchemy from heat.common import context from heat.common import exception +from heat.db import api as db_api from heat.engine import environment from heat.engine import parser from heat.engine import resource - -from heat.db import api as db_api from heat.openstack.common.db.sqlalchemy import session get_engine = session.get_engine