diff --git a/bin/ceilometer-send-counter b/bin/ceilometer-send-counter index 9a53c7271..62162c19b 100755 --- a/bin/ceilometer-send-counter +++ b/bin/ceilometer-send-counter @@ -25,12 +25,12 @@ import sys from oslo.config import cfg -from ceilometer import sample +from ceilometer.openstack.common import context +from ceilometer.openstack.common import timeutils from ceilometer import pipeline +from ceilometer import sample from ceilometer import service from ceilometer import transformer -from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common import context cfg.CONF.register_cli_opts([ diff --git a/ceilometer/alarm/evaluator/__init__.py b/ceilometer/alarm/evaluator/__init__.py index b2030d962..36a8254a7 100644 --- a/ceilometer/alarm/evaluator/__init__.py +++ b/ceilometer/alarm/evaluator/__init__.py @@ -18,14 +18,13 @@ import abc -import six - -from oslo.config import cfg from ceilometerclient import client as ceiloclient +from oslo.config import cfg +import six -from ceilometer.openstack.common import log from ceilometer.openstack.common.gettextutils import _ +from ceilometer.openstack.common import log LOG = log.getLogger(__name__) diff --git a/ceilometer/alarm/evaluator/combination.py b/ceilometer/alarm/evaluator/combination.py index 82948eb24..25f0c9e18 100644 --- a/ceilometer/alarm/evaluator/combination.py +++ b/ceilometer/alarm/evaluator/combination.py @@ -19,8 +19,8 @@ from ceilometer.alarm import evaluator from ceilometer.alarm.evaluator import OK, ALARM, UNKNOWN -from ceilometer.openstack.common import log from ceilometer.openstack.common.gettextutils import _ +from ceilometer.openstack.common import log LOG = log.getLogger(__name__) diff --git a/ceilometer/alarm/evaluator/threshold.py b/ceilometer/alarm/evaluator/threshold.py index 4e740f374..9c166faa0 100644 --- a/ceilometer/alarm/evaluator/threshold.py +++ b/ceilometer/alarm/evaluator/threshold.py @@ -22,9 +22,9 @@ import operator from ceilometer.alarm import evaluator from ceilometer.alarm.evaluator import OK, ALARM, UNKNOWN +from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.gettextutils import _ LOG = log.getLogger(__name__) diff --git a/ceilometer/alarm/partition/coordination.py b/ceilometer/alarm/partition/coordination.py index b3ad83f89..998eabf03 100644 --- a/ceilometer/alarm/partition/coordination.py +++ b/ceilometer/alarm/partition/coordination.py @@ -21,9 +21,9 @@ import random import uuid from ceilometer.alarm import rpc as rpc_alarm +from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.gettextutils import _ LOG = log.getLogger(__name__) diff --git a/ceilometer/alarm/rpc.py b/ceilometer/alarm/rpc.py index 9ccfc9efc..83db08c82 100644 --- a/ceilometer/alarm/rpc.py +++ b/ceilometer/alarm/rpc.py @@ -19,9 +19,9 @@ from oslo.config import cfg from ceilometer.openstack.common import context -from ceilometer.openstack.common.rpc import proxy as rpc_proxy -from ceilometer.openstack.common import log from ceilometer.openstack.common.gettextutils import _ +from ceilometer.openstack.common import log +from ceilometer.openstack.common.rpc import proxy as rpc_proxy from ceilometer.storage.models import Alarm OPTS = [ diff --git a/ceilometer/alarm/service.py b/ceilometer/alarm/service.py index 099e48376..5e5afb3a1 100644 --- a/ceilometer/alarm/service.py +++ b/ceilometer/alarm/service.py @@ -19,22 +19,22 @@ # under the License. import abc -import six +from ceilometerclient import client as ceiloclient from oslo.config import cfg +import six from stevedore import extension -from ceilometer.alarm import rpc as rpc_alarm from ceilometer.alarm.partition import coordination -from ceilometer.service import prepare_service +from ceilometer.alarm import rpc as rpc_alarm +from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import importutils from ceilometer.openstack.common import log from ceilometer.openstack.common import network_utils -from ceilometer.openstack.common import service as os_service -from ceilometer.openstack.common.gettextutils import _ -from ceilometer.openstack.common.rpc import service as rpc_service from ceilometer.openstack.common.rpc import dispatcher as rpc_dispatcher -from ceilometerclient import client as ceiloclient +from ceilometer.openstack.common.rpc import service as rpc_service +from ceilometer.openstack.common import service as os_service +from ceilometer.service import prepare_service OPTS = [ diff --git a/ceilometer/api/app.py b/ceilometer/api/app.py index 8ffe092f8..3ecf4a333 100644 --- a/ceilometer/api/app.py +++ b/ceilometer/api/app.py @@ -18,6 +18,8 @@ import logging import os +from wsgiref import simple_server + from oslo.config import cfg import pecan @@ -25,10 +27,9 @@ from ceilometer.api import acl from ceilometer.api import config as api_config from ceilometer.api import hooks from ceilometer.api import middleware +from ceilometer.openstack.common import log from ceilometer import service from ceilometer import storage -from ceilometer.openstack.common import log -from wsgiref import simple_server LOG = log.getLogger(__name__) diff --git a/ceilometer/api/controllers/v2.py b/ceilometer/api/controllers/v2.py index 1c180c4a6..618eeb83b 100644 --- a/ceilometer/api/controllers/v2.py +++ b/ceilometer/api/controllers/v2.py @@ -29,16 +29,16 @@ import datetime import inspect import json import uuid -import pecan -import six -from pecan import rest from oslo.config import cfg - +import pecan +from pecan import rest +import six import wsme -import wsmeext.pecan as wsme_pecan from wsme import types as wtypes +import wsmeext.pecan as wsme_pecan +from ceilometer.api import acl from ceilometer.openstack.common import context from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log @@ -48,7 +48,6 @@ from ceilometer.openstack.common import timeutils from ceilometer import sample from ceilometer import storage from ceilometer import utils -from ceilometer.api import acl LOG = log.getLogger(__name__) diff --git a/ceilometer/api/hooks.py b/ceilometer/api/hooks.py index 8d7f33b05..bcd4cd1c8 100644 --- a/ceilometer/api/hooks.py +++ b/ceilometer/api/hooks.py @@ -18,6 +18,7 @@ # under the License. import threading + from oslo.config import cfg from pecan import hooks diff --git a/ceilometer/central/manager.py b/ceilometer/central/manager.py index 782b3a219..7c55cf453 100644 --- a/ceilometer/central/manager.py +++ b/ceilometer/central/manager.py @@ -22,8 +22,8 @@ from stevedore import extension from ceilometer import agent from ceilometer.openstack.common import log -from ceilometer.openstack.common import service as os_service from ceilometer.openstack.common.rpc import service as rpc_service +from ceilometer.openstack.common import service as os_service from ceilometer import service cfg.CONF.import_group('service_credentials', 'ceilometer.service') diff --git a/ceilometer/collector/dispatcher/database.py b/ceilometer/collector/dispatcher/database.py index 0837b1bbd..40dde68cf 100644 --- a/ceilometer/collector/dispatcher/database.py +++ b/ceilometer/collector/dispatcher/database.py @@ -16,12 +16,11 @@ # License for the specific language governing permissions and limitations # under the License. - -from ceilometer import storage from ceilometer.collector import dispatcher from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils from ceilometer.publisher import rpc as publisher_rpc +from ceilometer import storage LOG = log.getLogger(__name__) diff --git a/ceilometer/collector/dispatcher/file.py b/ceilometer/collector/dispatcher/file.py index e4d6144f4..cf27edc79 100644 --- a/ceilometer/collector/dispatcher/file.py +++ b/ceilometer/collector/dispatcher/file.py @@ -18,7 +18,9 @@ import logging import logging.handlers + from oslo.config import cfg + from ceilometer.collector import dispatcher file_dispatcher_opts = [ diff --git a/ceilometer/collector/service.py b/ceilometer/collector/service.py index b8ffbb4c2..4349a894f 100644 --- a/ceilometer/collector/service.py +++ b/ceilometer/collector/service.py @@ -16,22 +16,22 @@ # License for the specific language governing permissions and limitations # under the License. +import socket + import msgpack from oslo.config import cfg -import socket from stevedore import extension from stevedore import named -from ceilometer.service import prepare_service from ceilometer.openstack.common import context from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log -from ceilometer.openstack.common import service as os_service from ceilometer.openstack.common.rpc import dispatcher as rpc_dispatcher from ceilometer.openstack.common.rpc import service as rpc_service - +from ceilometer.openstack.common import service as os_service from ceilometer.openstack.common import timeutils from ceilometer import pipeline +from ceilometer.service import prepare_service from ceilometer.storage import models from ceilometer import transformer diff --git a/ceilometer/compute/manager.py b/ceilometer/compute/manager.py index 85fd6414c..cfbc5aa27 100644 --- a/ceilometer/compute/manager.py +++ b/ceilometer/compute/manager.py @@ -23,8 +23,8 @@ from ceilometer import agent from ceilometer.compute.virt import inspector as virt_inspector from ceilometer import nova_client from ceilometer.openstack.common import log -from ceilometer.openstack.common import service as os_service from ceilometer.openstack.common.rpc import service as rpc_service +from ceilometer.openstack.common import service as os_service from ceilometer import service LOG = log.getLogger(__name__) diff --git a/ceilometer/compute/notifications.py b/ceilometer/compute/notifications.py index 5b59da27d..405ea9672 100644 --- a/ceilometer/compute/notifications.py +++ b/ceilometer/compute/notifications.py @@ -22,8 +22,8 @@ from oslo.config import cfg -from ceilometer import sample from ceilometer import plugin +from ceilometer import sample OPTS = [ diff --git a/ceilometer/compute/nova_notifier.py b/ceilometer/compute/nova_notifier.py index 3a191af82..0ef7ff66a 100644 --- a/ceilometer/compute/nova_notifier.py +++ b/ceilometer/compute/nova_notifier.py @@ -19,8 +19,8 @@ import sys from nova import notifications -from nova.openstack.common.notifier import api as notifier_api from nova.openstack.common import log as logging +from nova.openstack.common.notifier import api as notifier_api # HACK(dhellmann): Insert the nova version of openstack.common into # sys.modules as though it was the copy from ceilometer, so that when diff --git a/ceilometer/compute/pollsters/cpu.py b/ceilometer/compute/pollsters/cpu.py index d6453f06d..414b5d0c1 100644 --- a/ceilometer/compute/pollsters/cpu.py +++ b/ceilometer/compute/pollsters/cpu.py @@ -18,11 +18,11 @@ # License for the specific language governing permissions and limitations # under the License. -from ceilometer import sample from ceilometer.compute import plugin from ceilometer.compute.pollsters import util from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.openstack.common import log +from ceilometer import sample LOG = log.getLogger(__name__) diff --git a/ceilometer/compute/pollsters/disk.py b/ceilometer/compute/pollsters/disk.py index 1a87f9474..1b17fa065 100644 --- a/ceilometer/compute/pollsters/disk.py +++ b/ceilometer/compute/pollsters/disk.py @@ -21,11 +21,11 @@ import abc import collections -from ceilometer import sample from ceilometer.compute import plugin from ceilometer.compute.pollsters import util from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.openstack.common import log +from ceilometer import sample LOG = log.getLogger(__name__) diff --git a/ceilometer/compute/pollsters/instance.py b/ceilometer/compute/pollsters/instance.py index 55b020665..2d79b1822 100644 --- a/ceilometer/compute/pollsters/instance.py +++ b/ceilometer/compute/pollsters/instance.py @@ -18,9 +18,9 @@ # License for the specific language governing permissions and limitations # under the License. -from ceilometer import sample from ceilometer.compute import plugin from ceilometer.compute.pollsters import util +from ceilometer import sample class InstancePollster(plugin.ComputePollster): diff --git a/ceilometer/compute/pollsters/net.py b/ceilometer/compute/pollsters/net.py index deb9960c5..bc5ab93e6 100644 --- a/ceilometer/compute/pollsters/net.py +++ b/ceilometer/compute/pollsters/net.py @@ -20,12 +20,12 @@ import copy -from ceilometer import sample from ceilometer.compute import plugin from ceilometer.compute.pollsters import util from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils +from ceilometer import sample LOG = log.getLogger(__name__) diff --git a/ceilometer/compute/pollsters/util.py b/ceilometer/compute/pollsters/util.py index b8d84977e..aa5d07046 100644 --- a/ceilometer/compute/pollsters/util.py +++ b/ceilometer/compute/pollsters/util.py @@ -20,8 +20,8 @@ from oslo.config import cfg -from ceilometer import sample from ceilometer.openstack.common import timeutils +from ceilometer import sample INSTANCE_PROPERTIES = [ diff --git a/ceilometer/compute/virt/hyperv/inspector.py b/ceilometer/compute/virt/hyperv/inspector.py index 57e8e27d2..568d814c6 100644 --- a/ceilometer/compute/virt/hyperv/inspector.py +++ b/ceilometer/compute/virt/hyperv/inspector.py @@ -18,8 +18,8 @@ from oslo.config import cfg -from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.compute.virt.hyperv import utilsv2 +from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.openstack.common import log CONF = cfg.CONF diff --git a/ceilometer/energy/kwapi.py b/ceilometer/energy/kwapi.py index 737c95847..309c49798 100644 --- a/ceilometer/energy/kwapi.py +++ b/ceilometer/energy/kwapi.py @@ -15,15 +15,15 @@ # under the License. import datetime -from oslo.config import cfg from keystoneclient import exceptions +from oslo.config import cfg import requests from ceilometer.central import plugin -from ceilometer import sample from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log +from ceilometer import sample LOG = log.getLogger(__name__) diff --git a/ceilometer/image/glance.py b/ceilometer/image/glance.py index 132e52303..1e992abce 100644 --- a/ceilometer/image/glance.py +++ b/ceilometer/image/glance.py @@ -19,14 +19,14 @@ """ from __future__ import absolute_import - import itertools + import glanceclient from oslo.config import cfg -from ceilometer import sample from ceilometer.openstack.common import timeutils from ceilometer import plugin +from ceilometer import sample class _Base(plugin.PollsterBase): diff --git a/ceilometer/image/notifications.py b/ceilometer/image/notifications.py index f0421a71a..eaa4c670f 100644 --- a/ceilometer/image/notifications.py +++ b/ceilometer/image/notifications.py @@ -21,8 +21,8 @@ from oslo.config import cfg -from ceilometer import sample from ceilometer import plugin +from ceilometer import sample OPTS = [ cfg.StrOpt('glance_control_exchange', diff --git a/ceilometer/network/floatingip.py b/ceilometer/network/floatingip.py index b443bb66c..04b1f093b 100644 --- a/ceilometer/network/floatingip.py +++ b/ceilometer/network/floatingip.py @@ -19,12 +19,11 @@ # License for the specific language governing permissions and limitations # under the License. +from ceilometer.central import plugin +from ceilometer import nova_client from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils - -from ceilometer.central import plugin from ceilometer import sample -from ceilometer import nova_client class FloatingIPPollster(plugin.CentralPollster): diff --git a/ceilometer/network/notifications.py b/ceilometer/network/notifications.py index 27ec6e8ac..3a5c507fd 100644 --- a/ceilometer/network/notifications.py +++ b/ceilometer/network/notifications.py @@ -22,9 +22,9 @@ from oslo.config import cfg -from ceilometer import sample from ceilometer.openstack.common import log from ceilometer import plugin +from ceilometer import sample OPTS = [ cfg.StrOpt('neutron_control_exchange', diff --git a/ceilometer/notifier.py b/ceilometer/notifier.py index 0b36af7ed..be7ef6e8a 100644 --- a/ceilometer/notifier.py +++ b/ceilometer/notifier.py @@ -16,10 +16,11 @@ # License for the specific language governing permissions and limitations # under the License. -from ceilometer import pipeline -from ceilometer import transformer from ceilometer.openstack.common import context as req_context from ceilometer.openstack.common import log as logging +from ceilometer import pipeline +from ceilometer import transformer + from stevedore import extension diff --git a/ceilometer/objectstore/swift.py b/ceilometer/objectstore/swift.py index 4dc1f4167..85b500ee6 100644 --- a/ceilometer/objectstore/swift.py +++ b/ceilometer/objectstore/swift.py @@ -19,18 +19,17 @@ """ from __future__ import absolute_import +from urlparse import urljoin +from keystoneclient import exceptions from oslo.config import cfg from swiftclient import client as swift -from keystoneclient import exceptions -from ceilometer import sample from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils from ceilometer import plugin - -from urlparse import urljoin +from ceilometer import sample LOG = log.getLogger(__name__) diff --git a/ceilometer/objectstore/swift_middleware.py b/ceilometer/objectstore/swift_middleware.py index 145c383f8..36432ed3b 100644 --- a/ceilometer/objectstore/swift_middleware.py +++ b/ceilometer/objectstore/swift_middleware.py @@ -55,10 +55,10 @@ except ImportError: # Swift <= 1.7.5 ... module exists and has class. from swift.common.middleware.proxy_logging import InputProxy -from ceilometer import sample from ceilometer.openstack.common import context from ceilometer.openstack.common import timeutils from ceilometer import pipeline +from ceilometer import sample from ceilometer import service from ceilometer import transformer diff --git a/ceilometer/pipeline.py b/ceilometer/pipeline.py index 379d73886..8234f5333 100644 --- a/ceilometer/pipeline.py +++ b/ceilometer/pipeline.py @@ -18,8 +18,8 @@ import fnmatch import itertools -import os import operator +import os from oslo.config import cfg import yaml diff --git a/ceilometer/publisher/__init__.py b/ceilometer/publisher/__init__.py index bda113835..94124747c 100644 --- a/ceilometer/publisher/__init__.py +++ b/ceilometer/publisher/__init__.py @@ -19,9 +19,11 @@ # under the License. import abc -from stevedore import driver -from ceilometer.openstack.common import network_utils + import six +from stevedore import driver + +from ceilometer.openstack.common import network_utils def get_publisher(url, namespace='ceilometer.publisher'): diff --git a/ceilometer/publisher/file.py b/ceilometer/publisher/file.py index 7c10a6da2..08e1589be 100644 --- a/ceilometer/publisher/file.py +++ b/ceilometer/publisher/file.py @@ -20,8 +20,8 @@ import logging import logging.handlers import urlparse -from ceilometer import publisher from ceilometer.openstack.common import log +from ceilometer import publisher LOG = log.getLogger(__name__) diff --git a/ceilometer/publisher/udp.py b/ceilometer/publisher/udp.py index cceecf48b..0ba874c01 100644 --- a/ceilometer/publisher/udp.py +++ b/ceilometer/publisher/udp.py @@ -18,13 +18,15 @@ """Publish a sample using an UDP mechanism """ -from ceilometer import publisher +import socket + +import msgpack +from oslo.config import cfg + +from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer.openstack.common import network_utils -from ceilometer.openstack.common.gettextutils import _ -import msgpack -import socket -from oslo.config import cfg +from ceilometer import publisher cfg.CONF.import_opt('udp_port', 'ceilometer.collector.service', group='collector') diff --git a/ceilometer/storage/__init__.py b/ceilometer/storage/__init__.py index dc88902f0..ab380e039 100644 --- a/ceilometer/storage/__init__.py +++ b/ceilometer/storage/__init__.py @@ -18,15 +18,14 @@ """Storage backend management """ - import urlparse from oslo.config import cfg from stevedore import driver from ceilometer.openstack.common import log -from ceilometer import utils from ceilometer import service +from ceilometer import utils LOG = log.getLogger(__name__) diff --git a/ceilometer/storage/impl_db2.py b/ceilometer/storage/impl_db2.py index b44f424b1..9e4b28c31 100644 --- a/ceilometer/storage/impl_db2.py +++ b/ceilometer/storage/impl_db2.py @@ -23,14 +23,14 @@ from __future__ import division import copy -import weakref +import datetime import itertools +import sys +import weakref import bson.code import bson.objectid -import datetime import pymongo -import sys from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log diff --git a/ceilometer/storage/impl_hbase.py b/ceilometer/storage/impl_hbase.py index 67f41ba01..dc3d7ba69 100644 --- a/ceilometer/storage/impl_hbase.py +++ b/ceilometer/storage/impl_hbase.py @@ -18,20 +18,21 @@ # under the License. """HBase storage backend """ -import json -import hashlib -import itertools import copy import datetime -import happybase +import hashlib +import itertools +import json import os import re import urlparse +import happybase + from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log -from ceilometer.openstack.common import timeutils from ceilometer.openstack.common import network_utils +from ceilometer.openstack.common import timeutils from ceilometer.storage import base from ceilometer.storage import models diff --git a/ceilometer/storage/impl_mongodb.py b/ceilometer/storage/impl_mongodb.py index 9ca881c65..e0c279742 100644 --- a/ceilometer/storage/impl_mongodb.py +++ b/ceilometer/storage/impl_mongodb.py @@ -22,21 +22,21 @@ import calendar import copy +import json import operator import weakref import bson.code import bson.objectid -import json import pymongo from oslo.config import cfg +from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer import storage from ceilometer.storage import base from ceilometer.storage import models -from ceilometer.openstack.common.gettextutils import _ cfg.CONF.import_opt('time_to_live', 'ceilometer.storage', group="database") diff --git a/ceilometer/storage/impl_sqlalchemy.py b/ceilometer/storage/impl_sqlalchemy.py index 660a11bcc..c3dc0b029 100644 --- a/ceilometer/storage/impl_sqlalchemy.py +++ b/ceilometer/storage/impl_sqlalchemy.py @@ -24,8 +24,8 @@ import os import types from sqlalchemy import and_ -from sqlalchemy import func from sqlalchemy import desc +from sqlalchemy import func from sqlalchemy.orm import aliased from ceilometer.openstack.common.db import exception as dbexc @@ -40,11 +40,11 @@ from ceilometer.storage.sqlalchemy.models import Alarm from ceilometer.storage.sqlalchemy.models import AlarmChange from ceilometer.storage.sqlalchemy.models import Base from ceilometer.storage.sqlalchemy.models import Event -from ceilometer.storage.sqlalchemy.models import Meter from ceilometer.storage.sqlalchemy.models import MetaBool from ceilometer.storage.sqlalchemy.models import MetaFloat from ceilometer.storage.sqlalchemy.models import MetaInt from ceilometer.storage.sqlalchemy.models import MetaText +from ceilometer.storage.sqlalchemy.models import Meter from ceilometer.storage.sqlalchemy.models import Project from ceilometer.storage.sqlalchemy.models import Resource from ceilometer.storage.sqlalchemy.models import Source diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/010_add_index_to_meter.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/010_add_index_to_meter.py index ba5db2e48..2b426be63 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/010_add_index_to_meter.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/010_add_index_to_meter.py @@ -14,6 +14,7 @@ # under the License. from sqlalchemy import Index + from ceilometer.storage.sqlalchemy.models import Meter diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/014_add_event_message_id.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/014_add_event_message_id.py index fedae91a9..dd4b76eac 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/014_add_event_message_id.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/014_add_event_message_id.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import sqlalchemy from migrate.changeset.constraint import UniqueConstraint +import sqlalchemy from ceilometer.storage.sqlalchemy import models diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/017_convert_timestamp_as_datetime_to_decimal.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/017_convert_timestamp_as_datetime_to_decimal.py index c0adc697d..e33f70243 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/017_convert_timestamp_as_datetime_to_decimal.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/017_convert_timestamp_as_datetime_to_decimal.py @@ -17,6 +17,7 @@ # under the License. import sqlalchemy as sa + from ceilometer.storage.sqlalchemy.models import PreciseTimestamp _col = 'timestamp' diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/018_resource_resource_metadata_is_text.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/018_resource_resource_metadata_is_text.py index 4749e8d96..6fa3334a3 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/018_resource_resource_metadata_is_text.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/018_resource_resource_metadata_is_text.py @@ -16,11 +16,10 @@ # License for the specific language governing permissions and limitations # under the License. - -from sqlalchemy import String -from sqlalchemy import Text from sqlalchemy import MetaData +from sqlalchemy import String from sqlalchemy import Table +from sqlalchemy import Text def upgrade(migrate_engine): diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/019_alarm_history_detail_is_text.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/019_alarm_history_detail_is_text.py index 1f9233b34..ff8698c37 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/019_alarm_history_detail_is_text.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/019_alarm_history_detail_is_text.py @@ -16,11 +16,10 @@ # License for the specific language governing permissions and limitations # under the License. - -from sqlalchemy import String -from sqlalchemy import Text from sqlalchemy import MetaData +from sqlalchemy import String from sqlalchemy import Table +from sqlalchemy import Text def upgrade(migrate_engine): diff --git a/ceilometer/storage/sqlalchemy/migrate_repo/versions/020_add_metadata_tables.py b/ceilometer/storage/sqlalchemy/migrate_repo/versions/020_add_metadata_tables.py index 085cd6b8f..818417cbd 100644 --- a/ceilometer/storage/sqlalchemy/migrate_repo/versions/020_add_metadata_tables.py +++ b/ceilometer/storage/sqlalchemy/migrate_repo/versions/020_add_metadata_tables.py @@ -21,10 +21,10 @@ from sqlalchemy import Float from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import MetaData +from sqlalchemy.sql import select from sqlalchemy import String from sqlalchemy import Table from sqlalchemy import Text -from sqlalchemy.sql import select from ceilometer import utils diff --git a/ceilometer/tests/api.py b/ceilometer/tests/api.py index 6efb2f3e0..920d09a11 100644 --- a/ceilometer/tests/api.py +++ b/ceilometer/tests/api.py @@ -24,10 +24,10 @@ import flask import pecan import pecan.testing -from ceilometer.openstack.common import jsonutils from ceilometer.api import acl from ceilometer.api.v1 import app as v1_app from ceilometer.api.v1 import blueprint as v1_blueprint +from ceilometer.openstack.common import jsonutils from ceilometer import service from ceilometer.tests import db as db_test_base diff --git a/ceilometer/tests/base.py b/ceilometer/tests/base.py index 840889f79..8330a4f8c 100644 --- a/ceilometer/tests/base.py +++ b/ceilometer/tests/base.py @@ -20,6 +20,7 @@ """ import functools import os.path + from testtools import testcase from ceilometer.openstack.common import test diff --git a/ceilometer/tests/db.py b/ceilometer/tests/db.py index b0fa7a24f..807c6660e 100644 --- a/ceilometer/tests/db.py +++ b/ceilometer/tests/db.py @@ -20,12 +20,13 @@ """Base classes for API tests.""" import os -import six import uuid import warnings -from ceilometer import storage +import six + from ceilometer.openstack.common.fixture import config +from ceilometer import storage from ceilometer.tests import base as test_base diff --git a/ceilometer/transformer/conversions.py b/ceilometer/transformer/conversions.py index 4a6e7ac55..876be633e 100644 --- a/ceilometer/transformer/conversions.py +++ b/ceilometer/transformer/conversions.py @@ -18,10 +18,10 @@ from collections import defaultdict -from ceilometer import sample from ceilometer.openstack.common.gettextutils import _ from ceilometer.openstack.common import log from ceilometer.openstack.common import timeutils +from ceilometer import sample from ceilometer import transformer LOG = log.getLogger(__name__) diff --git a/ceilometer/volume/notifications.py b/ceilometer/volume/notifications.py index b5e1ea67e..e98019820 100644 --- a/ceilometer/volume/notifications.py +++ b/ceilometer/volume/notifications.py @@ -21,8 +21,8 @@ events. from oslo.config import cfg -from ceilometer import sample from ceilometer import plugin +from ceilometer import sample OPTS = [ diff --git a/tests/agentbase.py b/tests/agentbase.py index 5ef1b41fe..0bc9fef44 100644 --- a/tests/agentbase.py +++ b/tests/agentbase.py @@ -21,17 +21,17 @@ import abc import datetime -import mock +import mock from stevedore import extension from stevedore.tests import manager as extension_tests -from ceilometer import sample -from ceilometer import pipeline from ceilometer import agent -from ceilometer import transformer from ceilometer.openstack.common.fixture import config +from ceilometer import pipeline +from ceilometer import sample from ceilometer.tests import base +from ceilometer import transformer default_test_data = sample.Sample( diff --git a/tests/alarm/evaluator/test_base.py b/tests/alarm/evaluator/test_base.py index 9b739db81..b06fd55a2 100644 --- a/tests/alarm/evaluator/test_base.py +++ b/tests/alarm/evaluator/test_base.py @@ -19,8 +19,8 @@ """ import mock -from ceilometer.openstack.common import test from ceilometer.alarm import evaluator +from ceilometer.openstack.common import test class TestEvaluatorBaseClass(test.BaseTestCase): diff --git a/tests/alarm/partition/test_coordination.py b/tests/alarm/partition/test_coordination.py index 5690c6b6a..3e08258aa 100644 --- a/tests/alarm/partition/test_coordination.py +++ b/tests/alarm/partition/test_coordination.py @@ -18,13 +18,14 @@ """Tests for ceilometer/alarm/partition/coordination.py """ import datetime -import mock import uuid +import mock + from ceilometer.alarm.partition import coordination +from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common import test from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.fixture import config from ceilometer.storage import models diff --git a/tests/alarm/test_notifier.py b/tests/alarm/test_notifier.py index 7568bf308..f7f4653ef 100644 --- a/tests/alarm/test_notifier.py +++ b/tests/alarm/test_notifier.py @@ -16,13 +16,14 @@ # License for the specific language governing permissions and limitations # under the License. import urlparse + import mock import requests from ceilometer.alarm import service from ceilometer.openstack.common import context -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import config +from ceilometer.openstack.common import test DATA_JSON = ('{"current": "ALARM", "alarm_id": "foobar",' diff --git a/tests/alarm/test_partitioned_alarm_svc.py b/tests/alarm/test_partitioned_alarm_svc.py index c7ee83fa9..711b1f689 100644 --- a/tests/alarm/test_partitioned_alarm_svc.py +++ b/tests/alarm/test_partitioned_alarm_svc.py @@ -17,14 +17,15 @@ # under the License. """Tests for ceilometer.alarm.service.PartitionedAlarmService. """ -import mock from contextlib import nested + +import mock from stevedore import extension from stevedore.tests import manager as extension_tests from ceilometer.alarm import service -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import config +from ceilometer.openstack.common import test class TestPartitionedAlarmService(test.BaseTestCase): diff --git a/tests/alarm/test_rpc.py b/tests/alarm/test_rpc.py index a06912f6d..edbff37d9 100644 --- a/tests/alarm/test_rpc.py +++ b/tests/alarm/test_rpc.py @@ -16,18 +16,18 @@ # License for the specific language governing permissions and limitations # under the License. - import uuid + +from ceilometerclient.v2.alarms import Alarm as AlarmClient import mock from ceilometer.alarm import rpc as rpc_alarm +from ceilometer.openstack.common.fixture import config +from ceilometer.openstack.common.fixture import moxstubout from ceilometer.openstack.common import rpc from ceilometer.openstack.common import test from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.fixture import config -from ceilometer.openstack.common.fixture import moxstubout from ceilometer.storage.models import Alarm as AlarmModel -from ceilometerclient.v2.alarms import Alarm as AlarmClient class TestRPCAlarmNotifier(test.BaseTestCase): diff --git a/tests/api/v1/test_app.py b/tests/api/v1/test_app.py index 89c02af62..fed5b8be5 100644 --- a/tests/api/v1/test_app.py +++ b/tests/api/v1/test_app.py @@ -19,12 +19,12 @@ """ import os -from ceilometer.api.v1 import app from ceilometer.api import acl -from ceilometer import service +from ceilometer.api.v1 import app from ceilometer.openstack.common import fileutils -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import config +from ceilometer.openstack.common import test +from ceilometer import service class TestApp(test.BaseTestCase): diff --git a/tests/api/v1/test_compute_duration_by_resource_scenarios.py b/tests/api/v1/test_compute_duration_by_resource_scenarios.py index 1d61823ff..f267ef7e7 100644 --- a/tests/api/v1/test_compute_duration_by_resource_scenarios.py +++ b/tests/api/v1/test_compute_duration_by_resource_scenarios.py @@ -20,10 +20,11 @@ import datetime import logging + import testscenarios -from ceilometer.openstack.common import timeutils from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import timeutils from ceilometer.storage import models from ceilometer.tests import api as tests_api from ceilometer.tests import db as tests_db diff --git a/tests/api/v2/test_acl_scenarios.py b/tests/api/v2/test_acl_scenarios.py index a4b7aa302..99d1acd00 100644 --- a/tests/api/v2/test_acl_scenarios.py +++ b/tests/api/v2/test_acl_scenarios.py @@ -19,15 +19,15 @@ import datetime import json + import testscenarios -from ceilometer import sample -from ceilometer.api import acl -from ceilometer.publisher import rpc -from ceilometer.tests import db as tests_db -from ceilometer.openstack.common import timeutils - from .base import FunctionalTest +from ceilometer.api import acl +from ceilometer.openstack.common import timeutils +from ceilometer.publisher import rpc +from ceilometer import sample +from ceilometer.tests import db as tests_db load_tests = testscenarios.load_tests_apply_scenarios diff --git a/tests/api/v2/test_alarm_scenarios.py b/tests/api/v2/test_alarm_scenarios.py index 223ef2529..0738485da 100644 --- a/tests/api/v2/test_alarm_scenarios.py +++ b/tests/api/v2/test_alarm_scenarios.py @@ -23,12 +23,12 @@ import datetime import json as jsonutils import logging -import mock import uuid + +import mock import testscenarios from .base import FunctionalTest - from ceilometer.storage.models import Alarm from ceilometer.tests import db as tests_db diff --git a/tests/api/v2/test_app.py b/tests/api/v2/test_app.py index a2c70f632..afd9c9349 100644 --- a/tests/api/v2/test_app.py +++ b/tests/api/v2/test_app.py @@ -20,16 +20,16 @@ """ import os -from ceilometer.api import app +from .base import FunctionalTest from ceilometer.api import acl -from ceilometer import service +from ceilometer.api import app from ceilometer.openstack.common import fileutils -from ceilometer.openstack.common import gettextutils from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import gettextutils +from ceilometer import service from ceilometer.tests import base from ceilometer.tests import db as tests_db -from .base import FunctionalTest class TestApp(base.BaseTestCase): diff --git a/tests/api/v2/test_compute_duration_by_resource_scenarios.py b/tests/api/v2/test_compute_duration_by_resource_scenarios.py index 97b2fa1f6..01318f6b0 100644 --- a/tests/api/v2/test_compute_duration_by_resource_scenarios.py +++ b/tests/api/v2/test_compute_duration_by_resource_scenarios.py @@ -20,13 +20,14 @@ import datetime import logging + import testscenarios -from ceilometer.openstack.common import timeutils +from .base import FunctionalTest from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import timeutils from ceilometer.storage import models from ceilometer.tests import db as tests_db -from .base import FunctionalTest load_tests = testscenarios.load_tests_apply_scenarios diff --git a/tests/api/v2/test_list_events_scenarios.py b/tests/api/v2/test_list_events_scenarios.py index cdc19e58f..b5e7268df 100644 --- a/tests/api/v2/test_list_events_scenarios.py +++ b/tests/api/v2/test_list_events_scenarios.py @@ -20,15 +20,15 @@ import datetime import logging -import webtest.app -import testscenarios +import testscenarios +import webtest.app + +from .base import FunctionalTest from ceilometer.publisher import rpc from ceilometer import sample from ceilometer.tests import db as tests_db -from .base import FunctionalTest - load_tests = testscenarios.load_tests_apply_scenarios LOG = logging.getLogger(__name__) diff --git a/tests/api/v2/test_post_samples_scenarios.py b/tests/api/v2/test_post_samples_scenarios.py index 3f1af5810..c02a23b00 100644 --- a/tests/api/v2/test_post_samples_scenarios.py +++ b/tests/api/v2/test_post_samples_scenarios.py @@ -21,15 +21,15 @@ import copy import datetime import logging + import testscenarios +from .base import FunctionalTest +from ceilometer.openstack.common.fixture import moxstubout from ceilometer.openstack.common import rpc from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.fixture import moxstubout from ceilometer.tests import db as tests_db -from .base import FunctionalTest - load_tests = testscenarios.load_tests_apply_scenarios LOG = logging.getLogger(__name__) diff --git a/tests/api/v2/test_query.py b/tests/api/v2/test_query.py index bd6ff36e2..1d5cff532 100644 --- a/tests/api/v2/test_query.py +++ b/tests/api/v2/test_query.py @@ -15,16 +15,16 @@ # under the License. """Test the methods related to query.""" import datetime -import mock +import mock import wsme -from ceilometer import storage from ceilometer.api.controllers import v2 as api from ceilometer.api.controllers.v2 import Query +from ceilometer.openstack.common.fixture import moxstubout from ceilometer.openstack.common import test from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.fixture import moxstubout +from ceilometer import storage from ceilometer.tests import base as tests_base diff --git a/tests/api/v2/test_statistics_scenarios.py b/tests/api/v2/test_statistics_scenarios.py index 7d026e99b..50eeb1d40 100644 --- a/tests/api/v2/test_statistics_scenarios.py +++ b/tests/api/v2/test_statistics_scenarios.py @@ -18,11 +18,12 @@ """Test events statistics retrieval.""" import datetime + import testscenarios from . import base -from ceilometer import sample from ceilometer.publisher import rpc +from ceilometer import sample from ceilometer.tests import db as tests_db load_tests = testscenarios.load_tests_apply_scenarios diff --git a/tests/central/test_manager.py b/tests/central/test_manager.py index 117b06c6a..b3018dd52 100644 --- a/tests/central/test_manager.py +++ b/tests/central/test_manager.py @@ -18,12 +18,12 @@ """Tests for ceilometer/central/manager.py """ -import mock from keystoneclient.v2_0 import client as ksclient +import mock from ceilometer.central import manager -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test from tests import agentbase diff --git a/tests/collector/dispatcher/test_db.py b/tests/collector/dispatcher/test_db.py index 833c91821..c1f56a93e 100644 --- a/tests/collector/dispatcher/test_db.py +++ b/tests/collector/dispatcher/test_db.py @@ -19,10 +19,10 @@ """ from datetime import datetime -from ceilometer.openstack.common import test +from ceilometer.collector.dispatcher import database from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common.fixture import moxstubout -from ceilometer.collector.dispatcher import database +from ceilometer.openstack.common import test from ceilometer.publisher import rpc from ceilometer.storage import base diff --git a/tests/collector/dispatcher/test_file.py b/tests/collector/dispatcher/test_file.py index c2e7f47b6..cfba4b69f 100644 --- a/tests/collector/dispatcher/test_file.py +++ b/tests/collector/dispatcher/test_file.py @@ -18,13 +18,13 @@ """Tests for ceilometer/collector/dispatcher/file.py """ +import logging.handlers import os import tempfile -import logging.handlers from ceilometer.collector.dispatcher import file -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import config +from ceilometer.openstack.common import test from ceilometer.publisher import rpc diff --git a/tests/collector/test_service.py b/tests/collector/test_service.py index 8dc3631d4..775bf5657 100644 --- a/tests/collector/test_service.py +++ b/tests/collector/test_service.py @@ -19,20 +19,20 @@ """ import datetime -import msgpack import socket +import mock from mock import patch -from mock import MagicMock +import msgpack from stevedore import extension from stevedore.tests import manager as test_manager -from ceilometer import sample from ceilometer.collector import service from ceilometer.compute import notifications -from ceilometer.openstack.common import timeutils from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import timeutils +from ceilometer import sample from ceilometer.storage import models from ceilometer.tests import base as tests_base @@ -131,7 +131,7 @@ class TestUDPCollectorService(TestCollector): ).as_dict() def test_udp_receive(self): - mock_dispatcher = MagicMock() + mock_dispatcher = mock.MagicMock() self.srv.dispatcher_manager = test_manager.TestExtensionManager( [extension.Extension('test', None, @@ -152,7 +152,7 @@ class TestUDPCollectorService(TestCollector): self.counter) def test_udp_receive_storage_error(self): - mock_dispatcher = MagicMock() + mock_dispatcher = mock.MagicMock() self.srv.dispatcher_manager = test_manager.TestExtensionManager( [extension.Extension('test', None, @@ -195,7 +195,7 @@ class TestCollectorService(TestCollector): self.srv = service.CollectorService('the-host', 'the-topic') self.ctx = None - @patch('ceilometer.pipeline.setup_pipeline', MagicMock()) + @patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock()) def test_init_host(self): # If we try to create a real RPC connection, init_host() never # returns. Mock it out so we can establish the service @@ -203,7 +203,7 @@ class TestCollectorService(TestCollector): with patch('ceilometer.openstack.common.rpc.create_connection'): self.srv.start() - @patch('ceilometer.pipeline.setup_pipeline', MagicMock()) + @patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock()) def test_process_notification(self): # If we try to create a real RPC connection, init_host() never # returns. Mock it out so we can establish the service @@ -211,7 +211,7 @@ class TestCollectorService(TestCollector): self.CONF.set_override("store_events", False, group="collector") with patch('ceilometer.openstack.common.rpc.create_connection'): self.srv.start() - self.srv.pipeline_manager.pipelines[0] = MagicMock() + self.srv.pipeline_manager.pipelines[0] = mock.MagicMock() self.srv.notification_manager = test_manager.TestExtensionManager( [extension.Extension('test', None, @@ -225,14 +225,14 @@ class TestCollectorService(TestCollector): def test_process_notification_no_events(self): self.CONF.set_override("store_events", False, group="collector") - self.srv.notification_manager = MagicMock() + self.srv.notification_manager = mock.MagicMock() with patch.object(self.srv, '_message_to_event') as fake_msg_to_event: self.srv.process_notification({}) self.assertFalse(fake_msg_to_event.called) def test_process_notification_with_events(self): self.CONF.set_override("store_events", True, group="collector") - self.srv.notification_manager = MagicMock() + self.srv.notification_manager = mock.MagicMock() with patch.object(self.srv, '_message_to_event') as fake_msg_to_event: self.srv.process_notification({}) self.assertTrue(fake_msg_to_event.called) @@ -244,7 +244,7 @@ class TestCollectorService(TestCollector): 'message_id': "abc", 'publisher_id': "1"} - mock_dispatcher = MagicMock() + mock_dispatcher = mock.MagicMock() self.srv.dispatcher_manager = test_manager.TestExtensionManager( [extension.Extension('test', None, @@ -265,7 +265,7 @@ class TestCollectorService(TestCollector): def test_message_to_event_duplicate(self): self.CONF.set_override("store_events", True, group="collector") - mock_dispatcher = MagicMock() + mock_dispatcher = mock.MagicMock() self.srv.dispatcher_manager = test_manager.TestExtensionManager( [extension.Extension('test', None, @@ -280,7 +280,7 @@ class TestCollectorService(TestCollector): def test_message_to_event_bad_event(self): self.CONF.set_override("store_events", True, group="collector") - mock_dispatcher = MagicMock() + mock_dispatcher = mock.MagicMock() self.srv.dispatcher_manager = test_manager.TestExtensionManager( [extension.Extension('test', None, diff --git a/tests/compute/pollsters/test_location_metadata.py b/tests/compute/pollsters/test_location_metadata.py index 8797335a7..735a7567e 100644 --- a/tests/compute/pollsters/test_location_metadata.py +++ b/tests/compute/pollsters/test_location_metadata.py @@ -22,9 +22,9 @@ import mock -from ceilometer.openstack.common import test from ceilometer.compute import manager from ceilometer.compute.pollsters import util +from ceilometer.openstack.common import test class FauxInstance(object): diff --git a/tests/compute/test_manager.py b/tests/compute/test_manager.py index 7057887a7..9b19282f6 100644 --- a/tests/compute/test_manager.py +++ b/tests/compute/test_manager.py @@ -19,10 +19,10 @@ """ import mock -from ceilometer import nova_client from ceilometer.compute import manager -from ceilometer.openstack.common import test +from ceilometer import nova_client from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test from tests import agentbase diff --git a/tests/compute/virt/hyperv/test_utilsv2.py b/tests/compute/virt/hyperv/test_utilsv2.py index 56f06dbc5..90e34c3e3 100644 --- a/tests/compute/virt/hyperv/test_utilsv2.py +++ b/tests/compute/virt/hyperv/test_utilsv2.py @@ -19,8 +19,8 @@ Tests for Hyper-V utilsv2. import mock -from ceilometer.compute.virt import inspector from ceilometer.compute.virt.hyperv import utilsv2 as utilsv2 +from ceilometer.compute.virt import inspector from ceilometer.openstack.common import test diff --git a/tests/compute/virt/libvirt/test_inspector.py b/tests/compute/virt/libvirt/test_inspector.py index 9fd969c29..3b6881889 100644 --- a/tests/compute/virt/libvirt/test_inspector.py +++ b/tests/compute/virt/libvirt/test_inspector.py @@ -19,12 +19,14 @@ """Tests for libvirt inspector. """ +from contextlib import nested + +import fixtures +import mock + from ceilometer.compute.virt import inspector as virt_inspector from ceilometer.compute.virt.libvirt import inspector as libvirt_inspector -import fixtures from ceilometer.openstack.common import test -import mock -from contextlib import nested class TestLibvirtInspection(test.BaseTestCase): diff --git a/tests/energy/test_kwapi.py b/tests/energy/test_kwapi.py index bf0ce5a08..78b9ffe65 100644 --- a/tests/energy/test_kwapi.py +++ b/tests/energy/test_kwapi.py @@ -15,15 +15,16 @@ # under the License. import datetime -import mock - -from ceilometer.energy import kwapi -from ceilometer.central import manager -from ceilometer.openstack.common import context -from ceilometer.openstack.common import test -from ceilometer.openstack.common.fixture import moxstubout from keystoneclient import exceptions +import mock + +from ceilometer.central import manager +from ceilometer.energy import kwapi +from ceilometer.openstack.common import context +from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test + PROBE_DICT = { "probes": { diff --git a/tests/image/test_glance.py b/tests/image/test_glance.py index 7bdfbaefd..57309dc13 100644 --- a/tests/image/test_glance.py +++ b/tests/image/test_glance.py @@ -18,11 +18,11 @@ import mock -from ceilometer.image import glance from ceilometer.central import manager +from ceilometer.image import glance from ceilometer.openstack.common import context -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test IMAGE_LIST = [ type('Image', (object,), diff --git a/tests/image/test_notifications.py b/tests/image/test_notifications.py index 5910d5043..c33fbfc5e 100644 --- a/tests/image/test_notifications.py +++ b/tests/image/test_notifications.py @@ -20,8 +20,8 @@ from datetime import datetime from ceilometer.image import notifications -from ceilometer import sample from ceilometer.openstack.common import test +from ceilometer import sample def fake_uuid(x): diff --git a/tests/objectstore/test_swift.py b/tests/objectstore/test_swift.py index 1f6f2c924..2254949f4 100644 --- a/tests/objectstore/test_swift.py +++ b/tests/objectstore/test_swift.py @@ -19,16 +19,15 @@ import collections +from keystoneclient import exceptions import mock +from swiftclient import client as swift_client import testscenarios from ceilometer.central import manager from ceilometer.objectstore import swift -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import moxstubout - -from keystoneclient import exceptions -from swiftclient import client as swift_client +from ceilometer.openstack.common import test load_tests = testscenarios.load_tests_apply_scenarios diff --git a/tests/objectstore/test_swift_middleware.py b/tests/objectstore/test_swift_middleware.py index ce25c44dd..7c6c0c9b2 100644 --- a/tests/objectstore/test_swift_middleware.py +++ b/tests/objectstore/test_swift_middleware.py @@ -18,14 +18,14 @@ # under the License. import cStringIO as StringIO -import mock +import mock from webob import Request from ceilometer.objectstore import swift_middleware -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test from ceilometer import pipeline diff --git a/tests/publisher/test_file.py b/tests/publisher/test_file.py index 9334f4b9b..c7f977217 100644 --- a/tests/publisher/test_file.py +++ b/tests/publisher/test_file.py @@ -19,15 +19,15 @@ """ import datetime -import os import logging import logging.handlers +import os import tempfile -from ceilometer import sample -from ceilometer.publisher import file -from ceilometer.openstack.common import test from ceilometer.openstack.common.network_utils import urlsplit +from ceilometer.openstack.common import test +from ceilometer.publisher import file +from ceilometer import sample class TestFilePublisher(test.BaseTestCase): diff --git a/tests/publisher/test_rpc_publisher.py b/tests/publisher/test_rpc_publisher.py index 9088972ca..e42ed93af 100644 --- a/tests/publisher/test_rpc_publisher.py +++ b/tests/publisher/test_rpc_publisher.py @@ -18,19 +18,18 @@ # under the License. """Tests for ceilometer/publisher/rpc.py """ - import datetime import eventlet import fixtures import mock -from ceilometer import sample +from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common import jsonutils from ceilometer.openstack.common import network_utils from ceilometer.openstack.common import test -from ceilometer.openstack.common.fixture import config from ceilometer.publisher import rpc +from ceilometer import sample class TestSignature(test.BaseTestCase): diff --git a/tests/publisher/test_udp.py b/tests/publisher/test_udp.py index 55d50e4e7..9006d293a 100644 --- a/tests/publisher/test_udp.py +++ b/tests/publisher/test_udp.py @@ -19,15 +19,16 @@ """ import datetime + import mock import msgpack -from ceilometer import sample -from ceilometer.publisher import udp -from ceilometer.openstack.common import test -from ceilometer.openstack.common import network_utils from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import network_utils +from ceilometer.openstack.common import test +from ceilometer.publisher import udp +from ceilometer import sample COUNTER_SOURCE = 'testsource' diff --git a/tests/storage/sqlalchemy/test_models.py b/tests/storage/sqlalchemy/test_models.py index c13614edb..165c0e43d 100644 --- a/tests/storage/sqlalchemy/test_models.py +++ b/tests/storage/sqlalchemy/test_models.py @@ -19,12 +19,12 @@ from datetime import datetime import mock -from sqlalchemy.types import DATETIME, NUMERIC from sqlalchemy.dialects.mysql import DECIMAL +from sqlalchemy.types import DATETIME, NUMERIC -from ceilometer import utils from ceilometer.openstack.common import test from ceilometer.storage.sqlalchemy import models +from ceilometer import utils class PreciseTimestampTest(test.BaseTestCase): diff --git a/tests/storage/test_get_engine.py b/tests/storage/test_get_engine.py index 515158875..1ed20dcac 100644 --- a/tests/storage/test_get_engine.py +++ b/tests/storage/test_get_engine.py @@ -20,8 +20,8 @@ import mox -from ceilometer import storage from ceilometer.openstack.common import test +from ceilometer import storage from ceilometer.storage import impl_log diff --git a/tests/storage/test_impl_log.py b/tests/storage/test_impl_log.py index fa3a72274..ef226e83a 100644 --- a/tests/storage/test_impl_log.py +++ b/tests/storage/test_impl_log.py @@ -17,8 +17,9 @@ # under the License. """Tests for ceilometer/storage/impl_log.py """ -from ceilometer.openstack.common import test + from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test from ceilometer.storage import impl_log diff --git a/tests/storage/test_impl_mongodb.py b/tests/storage/test_impl_mongodb.py index fdcea7be3..5bd48d4a4 100644 --- a/tests/storage/test_impl_mongodb.py +++ b/tests/storage/test_impl_mongodb.py @@ -29,11 +29,10 @@ import datetime from ceilometer.publisher import rpc from ceilometer import sample -from ceilometer.storage import impl_mongodb -from ceilometer.storage.base import NoResultFound from ceilometer.storage.base import MultipleResultsFound +from ceilometer.storage.base import NoResultFound +from ceilometer.storage import impl_mongodb from ceilometer.tests import db as tests_db - from tests.storage import test_storage_scenarios diff --git a/tests/storage/test_impl_sqlalchemy.py b/tests/storage/test_impl_sqlalchemy.py index c31b28f87..47f6f3ff1 100644 --- a/tests/storage/test_impl_sqlalchemy.py +++ b/tests/storage/test_impl_sqlalchemy.py @@ -25,13 +25,14 @@ import datetime import repr + from mock import patch from ceilometer.storage import models -from ceilometer.storage.sqlalchemy.models import table_args from ceilometer.storage.sqlalchemy import models as sql_models -from ceilometer import utils +from ceilometer.storage.sqlalchemy.models import table_args from ceilometer.tests import db as tests_db +from ceilometer import utils class EventTestBase(tests_db.TestBase): diff --git a/tests/storage/test_storage_scenarios.py b/tests/storage/test_storage_scenarios.py index 607a57fc0..c07a6ae86 100644 --- a/tests/storage/test_storage_scenarios.py +++ b/tests/storage/test_storage_scenarios.py @@ -20,15 +20,16 @@ """ import datetime + import testscenarios -from ceilometer.publisher import rpc -from ceilometer.openstack.common import timeutils from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import timeutils +from ceilometer.publisher import rpc from ceilometer import sample from ceilometer import storage -from ceilometer.storage import models from ceilometer.storage.base import Pagination +from ceilometer.storage import models from ceilometer.tests import db as tests_db load_tests = testscenarios.load_tests_apply_scenarios diff --git a/tests/test_bin.py b/tests/test_bin.py index 1e4074249..de311107f 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -17,7 +17,6 @@ # License for the specific language governing permissions and limitations # under the License. -import httplib2 import json import os import random @@ -25,8 +24,10 @@ import socket import subprocess import time -from ceilometer.tests import base +import httplib2 + from ceilometer.openstack.common import fileutils +from ceilometer.tests import base class BinTestCase(base.BaseTestCase): diff --git a/tests/test_middleware.py b/tests/test_middleware.py index 1c4287e38..f5429ac2d 100644 --- a/tests/test_middleware.py +++ b/tests/test_middleware.py @@ -15,9 +15,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from ceilometer.openstack.common import test -from ceilometer.openstack.common.fixture import config + from ceilometer import middleware +from ceilometer.openstack.common.fixture import config +from ceilometer.openstack.common import test HTTP_REQUEST = { diff --git a/tests/test_notifier.py b/tests/test_notifier.py index 820932f41..15a8c6af7 100644 --- a/tests/test_notifier.py +++ b/tests/test_notifier.py @@ -19,9 +19,9 @@ """ from ceilometer import notifier +from ceilometer.openstack.common import test from ceilometer import pipeline from ceilometer import transformer -from ceilometer.openstack.common import test MESSAGE = { diff --git a/tests/test_novaclient.py b/tests/test_novaclient.py index 72fbe32a4..181c80855 100644 --- a/tests/test_novaclient.py +++ b/tests/test_novaclient.py @@ -18,11 +18,11 @@ # under the License. import mock - import novaclient + from ceilometer import nova_client -from ceilometer.openstack.common import test from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test class TestNovaClient(test.BaseTestCase): diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 5cfd965c6..8aa57a763 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -21,16 +21,16 @@ import datetime from stevedore import extension -from ceilometer import sample +from ceilometer.openstack.common.fixture import moxstubout +from ceilometer.openstack.common import test +from ceilometer.openstack.common import timeutils +from ceilometer import pipeline from ceilometer import publisher from ceilometer.publisher import test as test_publisher +from ceilometer import sample from ceilometer import transformer from ceilometer.transformer import accumulator from ceilometer.transformer import conversions -from ceilometer.openstack.common import test -from ceilometer.openstack.common import timeutils -from ceilometer.openstack.common.fixture import moxstubout -from ceilometer import pipeline class TestTransformerAccumulator(test.BaseTestCase): diff --git a/tests/test_plugin.py b/tests/test_plugin.py index fd1ce45db..ce48f28d8 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -16,8 +16,8 @@ # License for the specific language governing permissions and limitations # under the License. -from ceilometer import plugin from ceilometer.openstack.common import test +from ceilometer import plugin TEST_NOTIFICATION = { diff --git a/tests/test_service.py b/tests/test_service.py index 1f662644a..586cd24ff 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -17,17 +17,19 @@ # License for the specific language governing permissions and limitations # under the License. -import yaml -import subprocess import os import shutil import signal -import time +import subprocess import threading -from ceilometer import service -from ceilometer.tests import base +import time + +import yaml + from ceilometer.openstack.common import fileutils from ceilometer.openstack.common import test +from ceilometer import service +from ceilometer.tests import base class ServiceTestCase(test.BaseTestCase): diff --git a/tests/test_utils.py b/tests/test_utils.py index d9b7afa18..2cbc13d18 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -19,8 +19,8 @@ # under the License. """Tests for ceilometer/utils.py """ -import decimal import datetime +import decimal from ceilometer.openstack.common import test from ceilometer import utils diff --git a/tox.ini b/tox.ini index d8a5bdd62..6fd6ad3e7 100644 --- a/tox.ini +++ b/tox.ini @@ -45,7 +45,7 @@ deps = -r{toxinidir}/requirements.txt commands = {posargs} [flake8] -ignore = H301,H306,H506 +ignore = H301,H506 builtins = _ exclude=.venv,.git,.tox,dist,doc,./ceilometer/openstack/common,*lib/python*,*egg,tools,nova_tests,build show-source = True