Order imports in alphabetical order (7/9)

This patch is one in a series to re-enable H306 style check rule
(imports are in alphabetical order). It touches roughly half of tests
(up to and including test_m*).

Implements: blueprint reduce-flake8-ignored-rules (partial)
Change-Id: Id1e10f7a519ceeb4339488760b36950440461edb
changes/17/71517/5
Pavlo Shchelokovskyy 9 years ago
parent 6a7fd79ae1
commit f7338aa008
  1. 11
      heat/tests/common.py
  2. 6
      heat/tests/db/test_migrations.py
  3. 3
      heat/tests/generic_resource.py
  4. 2
      heat/tests/test_api_aws.py
  5. 8
      heat/tests/test_api_cfn_v1.py
  6. 6
      heat/tests/test_api_cloudwatch.py
  7. 9
      heat/tests/test_api_ec2token.py
  8. 29
      heat/tests/test_api_openstack_v1.py
  9. 2
      heat/tests/test_api_openstack_v1_views_stacks_view_builder.py
  10. 2
      heat/tests/test_api_openstack_v1_views_views_common.py
  11. 2
      heat/tests/test_auth_password.py
  12. 20
      heat/tests/test_autoscaling.py
  13. 12
      heat/tests/test_autoscaling_update_policy.py
  14. 22
      heat/tests/test_ceilometer_alarm.py
  15. 4
      heat/tests/test_cloudwatch.py
  16. 2
      heat/tests/test_common_policy.py
  17. 4
      heat/tests/test_cw_alarm.py
  18. 2
      heat/tests/test_dbinstance.py
  19. 2
      heat/tests/test_dependencies.py
  20. 7
      heat/tests/test_eip.py
  21. 12
      heat/tests/test_engine_api_utils.py
  22. 38
      heat/tests/test_engine_service.py
  23. 13
      heat/tests/test_environment.py
  24. 10
      heat/tests/test_event.py
  25. 8
      heat/tests/test_heat_autoscaling_group.py
  26. 14
      heat/tests/test_hot.py
  27. 9
      heat/tests/test_instance.py
  28. 7
      heat/tests/test_instance_group.py
  29. 7
      heat/tests/test_instance_group_update_policy.py
  30. 8
      heat/tests/test_instance_network.py
  31. 12
      heat/tests/test_loadbalancer.py
  32. 13
      heat/tests/test_metadata_refresh.py
  33. 2
      heat/tests/v1_1/fakes.py

@ -12,22 +12,21 @@
# under the License.
import fixtures
import logging
import mox
import os
import sys
import time
import testscenarios
import testtools
import fixtures
import mox
from oslo.config import cfg
from heat.openstack.common.fixture import mockpatch
import testscenarios
import testtools
from heat.engine import environment
from heat.engine import resources
from heat.engine import scheduler
from heat.openstack.common.fixture import mockpatch
class HeatTestCase(testscenarios.WithScenarios, testtools.TestCase):

@ -20,21 +20,21 @@ properly both upgrading and downgrading, and that no data loss occurs
if possible.
"""
import datetime
import os
import shutil
import sqlalchemy
import subprocess
import tempfile
import uuid
import datetime
from migrate.versioning import repository
import sqlalchemy
from heat.db.sqlalchemy import migrate_repo
from heat.db.sqlalchemy import migration
from heat.openstack.common.db.sqlalchemy import test_migrations
from heat.openstack.common import log as logging
from heat.openstack.common.py3kcompat import urlutils
from heat.openstack.common.db.sqlalchemy import test_migrations
LOG = logging.getLogger(__name__)

@ -14,9 +14,8 @@
from heat.engine import resource
from heat.engine import signal_responder
from heat.engine import stack_user
from heat.openstack.common import log as logging
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging
logger = logging.getLogger(__name__)

@ -12,8 +12,8 @@
# under the License.
from heat.tests.common import HeatTestCase
from heat.api.aws import utils as api_utils
from heat.tests.common import HeatTestCase
class AWSCommonTest(HeatTestCase):

@ -12,19 +12,19 @@
# under the License.
import json
import mock
import os
import mock
from oslo.config import cfg
from heat.api.aws import exception
import heat.api.cfn.v1.stacks as stacks
from heat.common import exception as heat_exception
from heat.common import identifier
from heat.common import policy
from heat.openstack.common import rpc
from heat.common.wsgi import Request
from heat.openstack.common import rpc
from heat.rpc import api as rpc_api
from heat.api.aws import exception
import heat.api.cfn.v1.stacks as stacks
from heat.tests.common import HeatTestCase
from heat.tests import utils

@ -15,11 +15,11 @@ import os
from oslo.config import cfg
from heat.common import policy
from heat.openstack.common import rpc
from heat.common.wsgi import Request
from heat.api.aws import exception
import heat.api.cloudwatch.watch as watches
from heat.common import policy
from heat.common.wsgi import Request
from heat.openstack.common import rpc
from heat.rpc import api as engine_api
from heat.tests.common import HeatTestCase
from heat.tests import utils

@ -12,17 +12,16 @@
# under the License.
from heat.tests.common import HeatTestCase
import requests
import json
from oslo.config import cfg
import requests
from heat.api.aws import ec2token
from heat.api.aws import exception
from heat.common.wsgi import Request
from heat.api.aws import ec2token
from heat.openstack.common import importutils
from heat.tests.common import HeatTestCase
class Ec2TokenTest(HeatTestCase):

@ -12,35 +12,32 @@
# under the License.
import json
import mock
import mock
from oslo.config import cfg
import webob.exc
from heat.common import identifier
from heat.openstack.common import rpc
import heat.api.middleware.fault as fault
import heat.api.openstack.v1 as api_v1
import heat.api.openstack.v1.actions as actions
import heat.api.openstack.v1.build_info as build_info
import heat.api.openstack.v1.events as events
import heat.api.openstack.v1.resources as resources
import heat.api.openstack.v1.software_configs as software_configs
import heat.api.openstack.v1.software_deployments as software_deployments
import heat.api.openstack.v1.stacks as stacks
from heat.common import exception as heat_exc
from heat.common import identifier
from heat.common import policy
from heat.common.wsgi import Request
from heat.common import urlfetch
from heat.common.wsgi import Request
from heat.openstack.common import rpc
from heat.openstack.common.rpc import common as rpc_common
from heat.rpc import api as rpc_api
from heat.rpc import client as rpc_client
from heat.tests.common import HeatTestCase
import heat.api.openstack.v1 as api_v1
import heat.api.openstack.v1.stacks as stacks
import heat.api.openstack.v1.resources as resources
import heat.api.openstack.v1.events as events
import heat.api.openstack.v1.actions as actions
import heat.api.openstack.v1.build_info as build_info
import heat.api.openstack.v1.software_configs as software_configs
import heat.api.openstack.v1.software_deployments as software_deployments
from heat.tests import utils
import heat.api.middleware.fault as fault
def request_with_middleware(middleware, func, req, *args, **kwargs):

@ -13,9 +13,9 @@
import mock
from heat.tests.common import HeatTestCase
from heat.api.openstack.v1.views import stacks_view
from heat.common import identifier
from heat.tests.common import HeatTestCase
class TestFormatStack(HeatTestCase):

@ -13,9 +13,9 @@
import mock
from heat.tests.common import HeatTestCase
from heat.api.openstack.v1.views import views_common
from heat.openstack.common.py3kcompat import urlutils
from heat.tests.common import HeatTestCase
class TestViewsCommon(HeatTestCase):

@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from keystoneclient.v2_0 import client as keystone_client
from keystoneclient.exceptions import Unauthorized
from keystoneclient.v2_0 import client as keystone_client
import webob
from heat.common.auth_password import KeystonePasswordAuthProtocol

@ -11,31 +11,29 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import copy
import datetime
import mock
import mox
from testtools import skipIf
from oslo.config import cfg
from testtools import skipIf
from heat.common import exception
from heat.common import short_id
from heat.common import template_format
from heat.common import exception
from heat.engine.resources import autoscaling as asc
from heat.engine.resources import loadbalancer
from heat.engine.resources import instance
from heat.engine.resources.neutron import loadbalancer as neutron_lb
from heat.engine.notification import autoscaling as notification
from heat.engine import parser
from heat.engine import resource
from heat.engine import scheduler
from heat.engine.resource import Metadata
from heat.engine.resources import autoscaling as asc
from heat.engine.resources import image
from heat.openstack.common import timeutils
from heat.engine.resources import instance
from heat.engine.resources import loadbalancer
from heat.engine.resources.neutron import loadbalancer as neutron_lb
from heat.engine import scheduler
from heat.openstack.common.importutils import try_import
from heat.openstack.common import timeutils
from heat.tests.common import HeatTestCase
from heat.tests import fakes
from heat.tests import utils

@ -11,26 +11,26 @@
# License for the specific language governing permissions and limitations
# under the License.
import mox
import json
import copy
import json
import mox
from oslo.config import cfg
from testtools.matchers import MatchesRegex
from heat.common import exception
from heat.common import template_format
from heat.engine.notification import stack as notification
from heat.engine import clients
from heat.engine.notification import stack as notification
from heat.engine import parser
from heat.engine import stack_user
from heat.engine.resources import instance
from heat.engine.resources import loadbalancer as lb
from heat.engine.resources import wait_condition as wc
from heat.engine import stack_user
from heat.tests.common import HeatTestCase
from heat.tests import utils
from heat.tests import fakes
from heat.tests import utils
from heat.tests.v1_1 import fakes as fakes11
from testtools.matchers import MatchesRegex
asg_tmpl_without_updt_policy = '''

@ -11,31 +11,27 @@
# License for the specific language governing permissions and limitations
# under the License.
import copy
import json
import mox
import testtools
import mox
from oslo.config import cfg
from heat.tests import fakes
from heat.tests import generic_resource
from heat.tests.common import HeatTestCase
from heat.tests import utils
import testtools
from heat.common import exception
from heat.common import template_format
from heat.openstack.common.importutils import try_import
from heat.engine import clients
from heat.engine import parser
from heat.engine.properties import schemata
from heat.engine import resource
from heat.engine.resources.ceilometer import alarm
from heat.engine import scheduler
from heat.engine import stack_user
from heat.engine.properties import schemata
from heat.engine.resources.ceilometer import alarm
from heat.openstack.common.importutils import try_import
from heat.tests.common import HeatTestCase
from heat.tests import fakes
from heat.tests import generic_resource
from heat.tests import utils
ceilometerclient = try_import('ceilometerclient.v2')

@ -15,10 +15,10 @@ from mock import patch
from heat.common import exception
from heat.common import template_format
from heat.tests import common
from heat.tests import utils
from heat.engine import scheduler
from heat.engine import watchrule
from heat.tests import common
from heat.tests import utils
AWS_CloudWatch_Alarm = '''

@ -17,8 +17,8 @@ import os.path
from oslo.config import cfg
from heat.common import policy
from heat.common import exception
from heat.common import policy
from heat.openstack.common import policy as base_policy
from heat.tests.common import HeatTestCase
from heat.tests import utils

@ -15,10 +15,10 @@
import copy
from heat.common import template_format
from heat.engine.resources import cloud_watch
from heat.engine import resource
from heat.engine import watchrule
from heat.engine.resources import cloud_watch
from heat.engine import scheduler
from heat.engine import watchrule
from heat.tests.common import HeatTestCase
from heat.tests import utils

@ -12,10 +12,10 @@
# under the License.
from heat.common import template_format
from heat.engine import parser
from heat.engine import resource
from heat.tests.common import HeatTestCase
from heat.tests import utils
from heat.engine import parser
rds_template = '''

@ -14,8 +14,8 @@
import testtools
from heat.engine.dependencies import Dependencies
from heat.engine.dependencies import CircularDependencyException
from heat.engine.dependencies import Dependencies
class dependenciesTest(testtools.TestCase):

@ -12,20 +12,19 @@
# under the License.
import mox
from testtools import skipIf
from heat.common import exception
from heat.common import template_format
from heat.engine.resources import eip
from heat.engine import clients
from heat.engine import parser
from heat.engine import resource
from heat.engine.resources import eip
from heat.engine import scheduler
from heat.engine import parser
from heat.tests.common import HeatTestCase
from heat.tests.v1_1 import fakes
from heat.tests import fakes as fakec
from heat.tests import utils
from heat.tests.v1_1 import fakes
eip_template = '''

@ -11,19 +11,19 @@
# License for the specific language governing permissions and limitations
# under the License.
from datetime import datetime
import json
import mock
import uuid
from datetime import datetime
import heat.engine.api as api
import mock
from heat.common.identifier import EventIdentifier
from heat.common import template_format
from heat.engine import parser
from heat.engine import api
from heat.engine.event import Event
from heat.engine import parameters
from heat.engine import parser
from heat.engine import resource
from heat.engine.event import Event
from heat.common.identifier import EventIdentifier
from heat.rpc import api as rpc_api
from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc

@ -13,47 +13,43 @@
import functools
from eventlet import greenpool
import json
import sys
import uuid
from eventlet import greenpool
import mock
import mox
from oslo.config import cfg
cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config')
from heat.common import exception
from heat.common import urlfetch
from heat.tests import fakes as test_fakes
from heat.tests.v1_1 import fakes
import heat.rpc.api as engine_api
import heat.db.api as db_api
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.engine import clients
from heat.engine import dependencies
from heat.engine import environment
from heat.engine import parser
from heat.engine.resource import _register_class
from heat.engine import service
from heat.engine.properties import Properties
from heat.engine import resource as res
from heat.engine.resources import instance as instances
from heat.engine.resources import nova_utils
from heat.engine import resource as rsrs
from heat.engine import service
from heat.engine import stack_lock
from heat.engine import watchrule
from heat.openstack.common.fixture import mockpatch
from heat.openstack.common import threadgroup
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.tests.common import HeatTestCase
from heat.tests import fakes as test_fakes
from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils
from heat.tests.v1_1 import fakes
cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config')
wp_template = '''
{
@ -1298,8 +1294,8 @@ class StackServiceAuthorizeTest(HeatTestCase):
self.eng = service.EngineService('a-host', 'a-topic')
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
_register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
res._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
utils.setup_dummy_db()
@ -1373,8 +1369,8 @@ class StackServiceTest(HeatTestCase):
self.eng = service.EngineService('a-host', 'a-topic')
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
_register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
res._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
utils.setup_dummy_db()
@ -1495,8 +1491,8 @@ class StackServiceTest(HeatTestCase):
@stack_context('event_list_deleted_stack')
def test_stack_event_list_deleted_resource(self):
rsrs._register_class('GenericResourceType',
generic_rsrc.GenericResource)
res._register_class('GenericResourceType',
generic_rsrc.GenericResource)
thread = self.m.CreateMockAnything()
thread.link(mox.IgnoreArg(), self.stack.id).AndReturn(None)
@ -2045,8 +2041,8 @@ class StackServiceTest(HeatTestCase):
service.EngineService.load_user_creds(
mox.IgnoreArg()).AndReturn(self.ctx)
self.m.StubOutWithMock(rsrs.Resource, 'signal')
rsrs.Resource.signal(mox.IgnoreArg()).AndReturn(None)
self.m.StubOutWithMock(res.Resource, 'signal')
res.Resource.signal(mox.IgnoreArg()).AndReturn(None)
self.m.ReplayAll()
self.eng.resource_signal(self.ctx,

@ -11,22 +11,21 @@
# 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 fixtures
import mock
import os.path
import sys
import fixtures
import mock
from oslo.config import cfg
cfg.CONF.import_opt('environment_dir', 'heat.common.config')
from heat.common import environment_format
from heat.engine import environment
from heat.engine import resources
from heat.tests import generic_resource
from heat.tests import common
from heat.tests import generic_resource
cfg.CONF.import_opt('environment_dir', 'heat.common.config')
class EnvironmentTest(common.HeatTestCase):

@ -13,19 +13,17 @@
from oslo.config import cfg
cfg.CONF.import_opt('event_purge_batch_size', 'heat.common.config')
cfg.CONF.import_opt('max_events_per_stack', 'heat.common.config')
import heat.db.api as db_api
from heat.db import api as db_api
from heat.engine import event
from heat.engine import parser
from heat.engine import resource
from heat.engine import template
from heat.engine import event
from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils
cfg.CONF.import_opt('event_purge_batch_size', 'heat.common.config')
cfg.CONF.import_opt('max_events_per_stack', 'heat.common.config')
tmpl = {
'Resources': {

@ -17,18 +17,14 @@ from oslo.config import cfg
from heat.common import exception
from heat.common import template_format
from heat.engine import clients
from heat.engine import resource
from heat.engine import scheduler
from heat.openstack.common import timeutils
from heat.tests.common import HeatTestCase
from heat.tests import fakes
from heat.tests import utils
from heat.tests import generic_resource
from heat.tests.common import HeatTestCase
from heat.tests import utils
class AutoScalingGroupTest(HeatTestCase):

@ -10,24 +10,24 @@
# 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 heat.common import template_format
from heat.common import exception
from heat.common import identifier
from heat.common import template_format
from heat.engine import constraints
from heat.engine import environment
from heat.engine import function
from heat.engine import parser
from heat.engine import resource
from heat.engine.hot import parameters as hot_param
from heat.engine.hot import template as hot_template
from heat.engine import parameters
from heat.engine import parser
from heat.engine import resource
from heat.engine import resources
from heat.engine import template
from heat.engine import constraints
from heat.engine import parameters
from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc
from heat.tests import test_parser
from heat.tests import utils
from heat.tests import generic_resource as generic_rsrc
hot_tpl_empty = template_format.parse('''

@ -15,24 +15,23 @@ import copy
import uuid
import mox
from neutronclient.v2_0 import client as neutronclient
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 import parser
from heat.engine import resource
from heat.engine import scheduler
from heat.engine.resources import image
from heat.engine.resources import instance as instances
from heat.engine.resources import network_interface
from heat.engine.resources import nova_utils
from heat.engine import scheduler
from heat.openstack.common import uuidutils
from heat.tests.common import HeatTestCase
from heat.tests import utils
from neutronclient.v2_0 import client as neutronclient
from heat.tests.v1_1 import fakes
wp_template = '''

@ -12,17 +12,18 @@
# under the License.
import copy
import mox
from heat.common import exception
from heat.common import template_format
from heat.engine import parser
from heat.engine import resource
from heat.engine import resources
from heat.engine.resources import image
from heat.engine.resources import instance
from heat.engine.resources import nova_keypair
from heat.engine import resource
from heat.engine import resources
from heat.engine import scheduler
from heat.engine import parser
from heat.tests.common import HeatTestCase
from heat.tests import utils

@ -11,9 +11,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import mox
import json
import copy
import json
import mox
from testtools.matchers import MatchesRegex
from heat.common import exception
from heat.common import template_format
@ -24,7 +26,6 @@ from heat.engine.resources import nova_keypair
from heat.tests.common import HeatTestCase
from heat.tests import utils
from heat.tests.v1_1 import fakes
from testtools.matchers import MatchesRegex
ig_tmpl_without_updt_policy = '''

@ -13,17 +13,17 @@
import uuid
from heat.common import template_format
from heat.engine import clients
from heat.engine import environment
from heat.tests.v1_1 import fakes
from heat.engine import parser
from heat.engine.resources import instance as instances
from heat.engine.resources import network_interface as network_interfaces
from heat.engine.resources import nova_utils
from heat.common import template_format
from heat.engine import clients
from heat.engine import parser
from heat.engine import scheduler
from heat.tests.common import HeatTestCase
from heat.tests import utils
from heat.tests.v1_1 import fakes
wp_template = '''

@ -11,25 +11,25 @@
# License for the specific language governing permissions and limitations
# under the License.
import re
import mock
import mox
import re
from oslo.config import cfg
from heat.common import exception
from heat.common import template_format
from heat.engine import clients
from heat.engine import scheduler
from heat.engine import stack_user
from heat.engine.resource import Metadata
from heat.engine.resources import instance
from heat.engine.resources import loadbalancer as lb
from heat.engine.resources import wait_condition as wc
from heat.engine.resource import Metadata
from heat.engine import scheduler
from heat.engine import stack_user
from heat.tests.common import HeatTestCase
from heat.tests import fakes as test_fakes
from heat.tests import utils
from heat.tests.v1_1 import fakes
from heat.tests import fakes as test_fakes
lb_template = '''

@ -13,22 +13,21 @@
import mox
from oslo.config import cfg
from heat.tests import fakes
from heat.tests.common import HeatTestCase
from heat.tests import utils
from heat.engine import environment
from heat.common import identifier
from heat.common import template_format
from heat.engine import environment
from heat.engine import parser
from heat.engine import scheduler
from heat.engine import service
from heat.engine.resources import image
from heat.engine.resources import instance
from heat.engine.resources import nova_keypair
from heat.engine.resources import wait_condition as wc
from heat.engine import scheduler
from heat.engine import service
from heat.tests.common import HeatTestCase
from heat.tests import fakes
from heat.tests import utils
test_template_metadata = '''

@ -17,9 +17,9 @@ import httplib2
from novaclient import client as base_client
from novaclient.v1_1 import client
from heat.tests import fakes
from heat.openstack.common.py3kcompat import urlutils
from heat.tests import fakes
class FakeClient(fakes.FakeClient, client.Client):

Loading…
Cancel
Save