From e0514cb85b6a82a665d918b419dc3495b0d4d9d1 Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Wed, 25 Oct 2017 12:59:07 +0300 Subject: [PATCH] Add I202 to flake ignore list Pep8 job currently fails complaining about I202 in a bunch of modules. This change fixes the genuine errors in the module import order, and adds I202 to the skip list so that we don't have to add noqa comments everywhere we can not satisfy the check. After we split out the tempest plugin, we'll remove I202 from the ignore list and add noqa comments in the places where it will still be needed. Change-Id: Ia170a41d35dea8c9eda2b36c907dbc518169a824 --- ironic/drivers/cisco_ucs.py | 2 -- ironic/drivers/modules/irmc/common.py | 3 +-- ironic/drivers/modules/oneview/inspect.py | 3 +-- ironic/drivers/modules/storage/cinder.py | 3 +-- ironic/tests/unit/api/test_ospmiddleware.py | 1 - ironic/tests/unit/db/test_node_tags.py | 1 - ironic/tests/unit/dhcp/test_neutron.py | 1 - ironic/tests/unit/drivers/modules/cimc/test_common.py | 1 - .../tests/unit/drivers/modules/cimc/test_management.py | 1 - ironic/tests/unit/drivers/modules/cimc/test_power.py | 1 - ironic/tests/unit/drivers/modules/irmc/test_boot.py | 1 - ironic/tests/unit/drivers/modules/irmc/test_common.py | 1 - ironic/tests/unit/drivers/modules/irmc/test_power.py | 1 - .../unit/drivers/modules/oneview/test_deploy_utils.py | 1 - ironic/tests/unit/drivers/test_cisco.py | 10 ++++------ ironic/tests/unit/drivers/test_drac.py | 1 - ironic_tempest_plugin/manager.py | 1 - ironic_tempest_plugin/tests/api/admin/test_nodes.py | 1 - tox.ini | 4 +++- 19 files changed, 10 insertions(+), 28 deletions(-) diff --git a/ironic/drivers/cisco_ucs.py b/ironic/drivers/cisco_ucs.py index 33a6cb02d7..7de186ee9c 100644 --- a/ironic/drivers/cisco_ucs.py +++ b/ironic/drivers/cisco_ucs.py @@ -15,10 +15,8 @@ Hardware types for Cisco UCS Servers """ from ironic.drivers import ipmi - from ironic.drivers.modules.cimc import management as cimc_mgmt from ironic.drivers.modules.cimc import power as cimc_power - from ironic.drivers.modules.ucs import management as ucs_mgmt from ironic.drivers.modules.ucs import power as ucs_power diff --git a/ironic/drivers/modules/irmc/common.py b/ironic/drivers/modules/irmc/common.py index 4bed206741..49c19f584b 100644 --- a/ironic/drivers/modules/irmc/common.py +++ b/ironic/drivers/modules/irmc/common.py @@ -15,10 +15,9 @@ """ Common functionalities shared between different iRMC modules. """ -import six - from oslo_log import log as logging from oslo_utils import importutils +import six from ironic.common import exception from ironic.common.i18n import _ diff --git a/ironic/drivers/modules/oneview/inspect.py b/ironic/drivers/modules/oneview/inspect.py index 8ea77d77e1..5aa87e9bb5 100644 --- a/ironic/drivers/modules/oneview/inspect.py +++ b/ironic/drivers/modules/oneview/inspect.py @@ -20,12 +20,11 @@ from oslo_utils import importutils from ironic.common import exception from ironic.common import states from ironic.conductor import task_manager +from ironic.conf import CONF from ironic.drivers.modules import inspector from ironic.drivers.modules.oneview import common from ironic.drivers.modules.oneview import deploy_utils -from ironic.conf import CONF - METRICS = metrics_utils.get_metrics_logger(__name__) oneview_exception = importutils.try_import('oneview_client.exceptions') diff --git a/ironic/drivers/modules/storage/cinder.py b/ironic/drivers/modules/storage/cinder.py index 12e35b28cb..96e08d589f 100644 --- a/ironic/drivers/modules/storage/cinder.py +++ b/ironic/drivers/modules/storage/cinder.py @@ -12,12 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -import retrying - from oslo_config import cfg from oslo_log import log from oslo_utils import excutils from oslo_utils import strutils +import retrying from ironic.common import cinder from ironic.common import exception diff --git a/ironic/tests/unit/api/test_ospmiddleware.py b/ironic/tests/unit/api/test_ospmiddleware.py index c90ab34739..48638aff76 100644 --- a/ironic/tests/unit/api/test_ospmiddleware.py +++ b/ironic/tests/unit/api/test_ospmiddleware.py @@ -11,7 +11,6 @@ # under the License. import mock - from oslo_config import cfg from osprofiler import web diff --git a/ironic/tests/unit/db/test_node_tags.py b/ironic/tests/unit/db/test_node_tags.py index c4388cd2f7..38c22e4a16 100644 --- a/ironic/tests/unit/db/test_node_tags.py +++ b/ironic/tests/unit/db/test_node_tags.py @@ -13,7 +13,6 @@ """Tests for manipulating NodeTags via the DB API""" from ironic.common import exception - from ironic.tests.unit.db import base from ironic.tests.unit.db import utils as db_utils diff --git a/ironic/tests/unit/dhcp/test_neutron.py b/ironic/tests/unit/dhcp/test_neutron.py index 1afab9e758..0f10d66be6 100644 --- a/ironic/tests/unit/dhcp/test_neutron.py +++ b/ironic/tests/unit/dhcp/test_neutron.py @@ -15,7 +15,6 @@ # under the License. import mock - from neutronclient.common import exceptions as neutron_client_exc from oslo_utils import uuidutils diff --git a/ironic/tests/unit/drivers/modules/cimc/test_common.py b/ironic/tests/unit/drivers/modules/cimc/test_common.py index 1fadd83545..0d405e7404 100644 --- a/ironic/tests/unit/drivers/modules/cimc/test_common.py +++ b/ironic/tests/unit/drivers/modules/cimc/test_common.py @@ -13,7 +13,6 @@ # limitations under the License. import mock - from oslo_config import cfg from oslo_utils import importutils from oslo_utils import uuidutils diff --git a/ironic/tests/unit/drivers/modules/cimc/test_management.py b/ironic/tests/unit/drivers/modules/cimc/test_management.py index 2e086ce6fb..6bdaf8d891 100644 --- a/ironic/tests/unit/drivers/modules/cimc/test_management.py +++ b/ironic/tests/unit/drivers/modules/cimc/test_management.py @@ -13,7 +13,6 @@ # limitations under the License. import mock - from oslo_utils import importutils from six.moves import http_client diff --git a/ironic/tests/unit/drivers/modules/cimc/test_power.py b/ironic/tests/unit/drivers/modules/cimc/test_power.py index f6a05bb8dc..4617c7d5cb 100644 --- a/ironic/tests/unit/drivers/modules/cimc/test_power.py +++ b/ironic/tests/unit/drivers/modules/cimc/test_power.py @@ -13,7 +13,6 @@ # limitations under the License. import mock - from oslo_config import cfg from oslo_utils import importutils diff --git a/ironic/tests/unit/drivers/modules/irmc/test_boot.py b/ironic/tests/unit/drivers/modules/irmc/test_boot.py index d911a27894..a496c46589 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_boot.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_boot.py @@ -45,7 +45,6 @@ from ironic.tests.unit.db import utils as db_utils from ironic.tests.unit.drivers import third_party_driver_mock_specs \ as mock_specs from ironic.tests.unit.objects import utils as obj_utils - if six.PY3: import io file = io.BytesIO diff --git a/ironic/tests/unit/drivers/modules/irmc/test_common.py b/ironic/tests/unit/drivers/modules/irmc/test_common.py index f42d5b0599..2d1f51d64f 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_common.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_common.py @@ -17,7 +17,6 @@ Test class for common methods used by iRMC modules. """ import mock - from oslo_config import cfg from ironic.common import exception diff --git a/ironic/tests/unit/drivers/modules/irmc/test_power.py b/ironic/tests/unit/drivers/modules/irmc/test_power.py index e0451c091d..fea12dc7d4 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_power.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_power.py @@ -17,7 +17,6 @@ Test class for iRMC Power Driver """ import mock - from oslo_utils import uuidutils from ironic.common import exception diff --git a/ironic/tests/unit/drivers/modules/oneview/test_deploy_utils.py b/ironic/tests/unit/drivers/modules/oneview/test_deploy_utils.py index 008475d9f4..44929456a6 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_deploy_utils.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_deploy_utils.py @@ -14,7 +14,6 @@ # under the License. import mock - from oslo_utils import importutils from ironic.common import driver_factory diff --git a/ironic/tests/unit/drivers/test_cisco.py b/ironic/tests/unit/drivers/test_cisco.py index 50630d901f..a4299d927a 100644 --- a/ironic/tests/unit/drivers/test_cisco.py +++ b/ironic/tests/unit/drivers/test_cisco.py @@ -12,19 +12,17 @@ from ironic.conductor import task_manager from ironic.drivers.modules import agent +from ironic.drivers.modules.cimc import management as cimc_mgmt +from ironic.drivers.modules.cimc import power as cimc_power from ironic.drivers.modules import ipmitool from ironic.drivers.modules import iscsi_deploy from ironic.drivers.modules import noop from ironic.drivers.modules import pxe from ironic.drivers.modules.storage import noop as noop_storage -from ironic.tests.unit.db import base as db_base -from ironic.tests.unit.objects import utils as obj_utils - -from ironic.drivers.modules.cimc import management as cimc_mgmt -from ironic.drivers.modules.cimc import power as cimc_power - from ironic.drivers.modules.ucs import management as ucs_mgmt from ironic.drivers.modules.ucs import power as ucs_power +from ironic.tests.unit.db import base as db_base +from ironic.tests.unit.objects import utils as obj_utils class CiscoUCSStandaloneHardwareTestCase(db_base.DbTestCase): diff --git a/ironic/tests/unit/drivers/test_drac.py b/ironic/tests/unit/drivers/test_drac.py index d5e610a745..53ed69c7d9 100644 --- a/ironic/tests/unit/drivers/test_drac.py +++ b/ironic/tests/unit/drivers/test_drac.py @@ -15,7 +15,6 @@ import inspect import mock - from oslo_utils import importutils from ironic.common import exception diff --git a/ironic_tempest_plugin/manager.py b/ironic_tempest_plugin/manager.py index 560a6cce4a..9967a5dbb3 100644 --- a/ironic_tempest_plugin/manager.py +++ b/ironic_tempest_plugin/manager.py @@ -23,7 +23,6 @@ import subprocess from oslo_log import log from oslo_utils import netutils - from tempest.common import compute from tempest.common.utils.linux import remote_client from tempest.common.utils import net_utils diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py index 08a57e0525..d992a65e24 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py +++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py @@ -11,7 +11,6 @@ # under the License. import six - from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators diff --git a/tox.ini b/tox.ini index 2b1c0496d9..cdd92acacd 100644 --- a/tox.ini +++ b/tox.ini @@ -98,7 +98,9 @@ setenv = PYTHONHASHSEED=0 commands = {posargs} [flake8] -ignore = E129 +# TODO(vdrok): Remove I202 from ignore list when we split out +# the tempest plugin +ignore = E129,I202 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build import-order-style = pep8 application-import-names = ironic