Make pep8 job great again

There is a bug in pep8, when 'select' used, it omits all default checks
and runs only those specified by 'select'.  We got hit by this issue
since I2d26534230ffe5d01aa0aab6ec902f81cfba774d was merged which lead to
almost no static checks in pep8 job.

Also note that off_by_default decorator has no effect for now because
factory in hacking is triggered after ignored checks are collected.
There will be a follow-up patch for that in order to make pep8 doing
its job quickly.

[1] https://github.com/PyCQA/pycodestyle/issues/390

Related-Bug: 1594756
Change-Id: I8e27f40908e1bb4307cc7c893169a9d99f3433c4
This commit is contained in:
Jakub Libosvar 2016-06-21 10:14:45 +00:00
parent b59bb0fcfa
commit 766abb752a
21 changed files with 18 additions and 27 deletions

View File

@ -24,7 +24,6 @@ from oslo_log import log as logging
import oslo_messaging import oslo_messaging
from oslo_service import loopingcall from oslo_service import loopingcall
from oslo_utils import timeutils from oslo_utils import timeutils
import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
@ -34,8 +33,8 @@ from neutron.common import utils
from neutron import context as ncontext from neutron import context as ncontext
from neutron.db import agents_db from neutron.db import agents_db
from neutron.db.availability_zone import network as network_az from neutron.db.availability_zone import network as network_az
from neutron.db import model_base # noqa
from neutron.db.network_dhcp_agent_binding import models as ndab_model from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import model_base
from neutron.extensions import agent as ext_agent from neutron.extensions import agent as ext_agent
from neutron.extensions import dhcpagentscheduler from neutron.extensions import dhcpagentscheduler
from neutron import worker as neutron_worker from neutron import worker as neutron_worker

View File

@ -21,7 +21,6 @@ from neutron_lib import constants
from neutron_lib.db import utils as db_utils from neutron_lib.db import utils as db_utils
from neutron_lib import exceptions as exc from neutron_lib import exceptions as exc
from oslo_config import cfg from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import utils as sa_utils from oslo_db.sqlalchemy import utils as sa_utils
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
@ -42,7 +41,6 @@ from neutron.common import exceptions as n_exc
from neutron.common import ipv6_utils from neutron.common import ipv6_utils
from neutron.common import utils from neutron.common import utils
from neutron import context as ctx from neutron import context as ctx
from neutron.db import api as db_api
from neutron.db import db_base_plugin_common from neutron.db import db_base_plugin_common
from neutron.db import ipam_non_pluggable_backend from neutron.db import ipam_non_pluggable_backend
from neutron.db import ipam_pluggable_backend from neutron.db import ipam_pluggable_backend

View File

@ -34,7 +34,6 @@ from neutron.db import models_v2
from neutron.extensions import portbindings from neutron.extensions import portbindings
from neutron.ipam import requests as ipam_req from neutron.ipam import requests as ipam_req
from neutron.ipam import subnet_alloc from neutron.ipam import subnet_alloc
from neutron.objects import subnetpool as subnetpool_obj
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -31,7 +31,6 @@ from neutron.extensions import portbindings
from neutron.ipam import driver from neutron.ipam import driver
from neutron.ipam import exceptions as ipam_exc from neutron.ipam import exceptions as ipam_exc
from neutron.ipam import requests as ipam_req from neutron.ipam import requests as ipam_req
from neutron.objects import subnetpool as subnetpool_obj
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -214,7 +214,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
models_v2.Port.id == addr_pair_db.AllowedAddressPair.port_id, models_v2.Port.id == addr_pair_db.AllowedAddressPair.port_id,
addr_pair_db.AllowedAddressPair.ip_address == fixed_ip, addr_pair_db.AllowedAddressPair.ip_address == fixed_ip,
models_v2.Port.network_id == network_id, models_v2.Port.network_id == network_id,
models_v2.Port.admin_state_up == True) models_v2.Port.admin_state_up == True) # noqa
return query.all() return query.all()
def _update_fip_assoc(self, context, fip, floatingip_db, external_port): def _update_fip_assoc(self, context, fip, floatingip_db, external_port):
@ -290,7 +290,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
address_pair_port=allowed_address_port)) address_pair_port=allowed_address_port))
if not updated_port: if not updated_port:
LOG.warning(_LW("Allowed_address_pair port update failed: %s"), LOG.warning(_LW("Allowed_address_pair port update failed: %s"),
updated_port) updated_port)
self.update_arp_entry_for_dvr_service_port(context, self.update_arp_entry_for_dvr_service_port(context,
service_port_dict) service_port_dict)

View File

@ -58,7 +58,7 @@ from neutron.plugins.ml2.drivers import type_vlan # noqa
from neutron.plugins.ml2.drivers import type_vxlan # noqa from neutron.plugins.ml2.drivers import type_vxlan # noqa
from neutron.plugins.ml2 import models # noqa from neutron.plugins.ml2 import models # noqa
from neutron.services.auto_allocate import models # noqa from neutron.services.auto_allocate import models # noqa
from neutron.services.segments import db # noqa from neutron.services.segments import db # noqa
from neutron.services.trunk import models # noqa from neutron.services.trunk import models # noqa

View File

@ -19,8 +19,8 @@ from sqlalchemy import sql
from neutron.api.v2 import attributes as attr from neutron.api.v2 import attributes as attr
from neutron.common import constants from neutron.common import constants
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import model_base from neutron.db import model_base
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import rbac_db_models from neutron.db import rbac_db_models

View File

@ -13,8 +13,8 @@
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from neutron.db import model_base
from neutron.db import agents_db from neutron.db import agents_db
from neutron.db import model_base
class NetworkDhcpAgentBinding(model_base.BASEV2): class NetworkDhcpAgentBinding(model_base.BASEV2):

View File

@ -187,7 +187,7 @@ class DbQuotaDriver(object):
# Do not even bother counting resources and calculating headroom # Do not even bother counting resources and calculating headroom
# for resources with unlimited quota # for resources with unlimited quota
LOG.debug("Resources %s have unlimited quota limit. It is not " LOG.debug("Resources %s have unlimited quota limit. It is not "
"required to calculate headroom ", "required to calculate headroom ",
",".join(unlimited_resources)) ",".join(unlimited_resources))
requested_resources = (set(requested_resources) - requested_resources = (set(requested_resources) -
unlimited_resources) unlimited_resources)

View File

@ -24,9 +24,9 @@ from oslo_log import log as logging
from sqlalchemy import sql from sqlalchemy import sql
from neutron._i18n import _LI, _LW from neutron._i18n import _LI, _LW
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import agents_db from neutron.db import agents_db
from neutron.db import api as db_api from neutron.db import api as db_api
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.extensions import availability_zone as az_ext from neutron.extensions import availability_zone as az_ext
from neutron.scheduler import base_resource_filter from neutron.scheduler import base_resource_filter
from neutron.scheduler import base_scheduler from neutron.scheduler import base_scheduler

View File

@ -330,4 +330,5 @@ class DHCPAgentOVSTestCase(DHCPAgentOVSTestFramework):
timeout=1, timeout=1,
sleep=0.1, sleep=0.1,
exception=RuntimeError("'dhcp_ready_on_ports' not be called")) exception=RuntimeError("'dhcp_ready_on_ports' not be called"))
self.mock_plugin_api.dhcp_ready_on_ports.assert_called_with(ports_to_send) self.mock_plugin_api.dhcp_ready_on_ports.assert_called_with(
ports_to_send)

View File

@ -16,9 +16,9 @@
import os import os
import unittest2
from pecan import set_config from pecan import set_config
from pecan.testing import load_test_app from pecan.testing import load_test_app
import unittest2
__all__ = ['FunctionalTest'] __all__ = ['FunctionalTest']

View File

@ -21,10 +21,10 @@ import six
import testscenarios import testscenarios
from neutron import context from neutron import context
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import agents_db from neutron.db import agents_db
from neutron.db import agentschedulers_db from neutron.db import agentschedulers_db
from neutron.db import common_db_mixin from neutron.db import common_db_mixin
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.extensions import providernet from neutron.extensions import providernet
from neutron.scheduler import dhcp_agent_scheduler from neutron.scheduler import dhcp_agent_scheduler
from neutron.tests.common import helpers from neutron.tests.common import helpers

View File

@ -31,7 +31,6 @@ class NetworkBasicTest(base.BaseTempestTestCase):
# Default to ipv4. # Default to ipv4.
_ip_version = 4 _ip_version = 4
@test.idempotent_id('de07fe0a-e955-449e-b48b-8641c14cd52e') @test.idempotent_id('de07fe0a-e955-449e-b48b-8641c14cd52e')
def test_basic_instance(self): def test_basic_instance(self):
network = self.create_network() network = self.create_network()

View File

@ -32,9 +32,9 @@ import unittest2
import neutron import neutron
from neutron.api.v2 import attributes from neutron.api.v2 import attributes
from neutron.db import common_db_mixin
from neutron.common import constants as n_const from neutron.common import constants as n_const
from neutron.common import ipv6_utils from neutron.common import ipv6_utils
from neutron.db import common_db_mixin
class AttributeMapMemento(fixtures.Fixture): class AttributeMapMemento(fixtures.Fixture):

View File

@ -15,7 +15,6 @@
import mock import mock
from neutron_lib import constants from neutron_lib import constants
from oslo_config import cfg
from neutron.callbacks import events from neutron.callbacks import events
from neutron.callbacks import registry from neutron.callbacks import registry

View File

@ -318,7 +318,6 @@ class TestAddressRequestFactory(base.BaseTestCase):
ipam_req.PreferNextAddressRequest) ipam_req.PreferNextAddressRequest)
class TestSubnetRequestFactory(IpamSubnetRequestTestCase): class TestSubnetRequestFactory(IpamSubnetRequestTestCase):
def _build_subnet_dict(self, id=None, cidr='192.168.1.0/24', def _build_subnet_dict(self, id=None, cidr='192.168.1.0/24',

View File

@ -816,6 +816,7 @@ class BaseDbObjectTestCase(_BaseObjectTestCase):
def test_get_objects_supports_extra_filtername(self): def test_get_objects_supports_extra_filtername(self):
self.filtered_args = None self.filtered_args = None
def foo_filter(query, filters): def foo_filter(query, filters):
self.filtered_args = filters self.filtered_args = filters
return query return query
@ -834,7 +835,7 @@ class BaseDbObjectTestCase(_BaseObjectTestCase):
class UniqueObjectBase(test_base.BaseTestCase): class UniqueObjectBase(test_base.BaseTestCase):
def setUp(self): def setUp(self):
super(UniqueObjectBase, self).setUp() super(UniqueObjectBase, self).setUp()
obj_registry = self.useFixture( obj_registry = self.useFixture(
fixture.VersionedObjectRegistryFixture()) fixture.VersionedObjectRegistryFixture())

View File

@ -22,10 +22,10 @@ from oslo_utils import importutils
import testscenarios import testscenarios
from neutron import context from neutron import context
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.db import agentschedulers_db as sched_db from neutron.db import agentschedulers_db as sched_db
from neutron.db import common_db_mixin from neutron.db import common_db_mixin
from neutron.db import models_v2 from neutron.db import models_v2
from neutron.db.network_dhcp_agent_binding import models as ndab_model
from neutron.extensions import dhcpagentscheduler from neutron.extensions import dhcpagentscheduler
from neutron.scheduler import dhcp_agent_scheduler from neutron.scheduler import dhcp_agent_scheduler
from neutron.tests.common import helpers from neutron.tests.common import helpers

View File

@ -1165,7 +1165,8 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase):
(l3plugin.l3_rpc_notifier.router_removed_from_agent. (l3plugin.l3_rpc_notifier.router_removed_from_agent.
assert_called_once_with(mock.ANY, 'foo_id', source_host)) assert_called_once_with(mock.ANY, 'foo_id', source_host))
self.assertEqual( self.assertEqual(
1, l3plugin.delete_arp_entry_for_dvr_service_port.call_count) 1,
l3plugin.delete_arp_entry_for_dvr_service_port.call_count)
if fip and not routers_to_remove: if fip and not routers_to_remove:
(l3plugin.l3_rpc_notifier.routers_updated_on_host. (l3plugin.l3_rpc_notifier.routers_updated_on_host.
assert_called_once_with(mock.ANY, ['router_id'], source_host)) assert_called_once_with(mock.ANY, ['router_id'], source_host))

View File

@ -128,10 +128,6 @@ commands = sphinx-build -W -b html doc/source doc/build/html
ignore = E125,E126,E128,E129,E265,H404,H405 ignore = E125,E126,E128,E129,E265,H404,H405
show-source = true show-source = true
exclude = ./.*,build,dist exclude = ./.*,build,dist
# N334 unittest2 must be used instead of unittest
# Off by default to avoid breaking external projects.
# Compliant projects can enable it like this:
select = N334
[hacking] [hacking]
import_exceptions = neutron._i18n import_exceptions = neutron._i18n