add local pep8 tox target
This patch adds the pep8-dev tox target for running pep8 locally as per [1]. In addition it updates the pylint version to work with python 3.x and addresses some pylint errors in the code. [1] https://etherpad.openstack.org/p/neutron-sibling-setup Change-Id: I7bd4d8e75601a7291692d6256925f46fb4fa5464
This commit is contained in:
parent
e8cddbe4fe
commit
d1d60b93bc
@ -19,6 +19,7 @@ import six
|
||||
|
||||
|
||||
if six.PY2:
|
||||
# pylint: disable=unexpected-keyword-arg
|
||||
gettext.install('neutron', unicode=1)
|
||||
else:
|
||||
gettext.install('neutron')
|
||||
|
@ -95,8 +95,7 @@ class Vpn_endpoint_groups(extensions.ExtensionDescriptor):
|
||||
def get_extended_resources(self, version):
|
||||
if version == "2.0":
|
||||
return RESOURCE_ATTRIBUTE_MAP
|
||||
else:
|
||||
return {}
|
||||
return {}
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
|
@ -58,8 +58,7 @@ class Vpn_flavors(extensions.ExtensionDescriptor):
|
||||
def get_extended_resources(self, version):
|
||||
if version == "2.0":
|
||||
return EXTENDED_ATTRIBUTES_2_0
|
||||
else:
|
||||
return {}
|
||||
return {}
|
||||
|
||||
def get_required_extensions(self):
|
||||
return ["vpnaas"]
|
||||
|
@ -492,8 +492,7 @@ class Vpnaas(extensions.ExtensionDescriptor):
|
||||
def get_extended_resources(self, version):
|
||||
if version == "2.0":
|
||||
return RESOURCE_ATTRIBUTE_MAP
|
||||
else:
|
||||
return {}
|
||||
return {}
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
|
@ -845,8 +845,7 @@ class IPsecDriver(device_drivers.DeviceDriver):
|
||||
# TODO(pcm): Use router object method to tell if DVR, when available
|
||||
if router.router['distributed']:
|
||||
return router.snat_namespace.name
|
||||
else:
|
||||
return router.ns_name
|
||||
return router.ns_name
|
||||
|
||||
def get_router_based_iptables_manager(self, router):
|
||||
"""Returns router based iptables manager
|
||||
@ -864,8 +863,7 @@ class IPsecDriver(device_drivers.DeviceDriver):
|
||||
# TODO(pcm): Use router object method to tell if DVR, when available
|
||||
if router.router['distributed']:
|
||||
return router.snat_iptables_manager
|
||||
else:
|
||||
return router.iptables_manager
|
||||
return router.iptables_manager
|
||||
|
||||
def add_nat_rule(self, router_id, chain, rule, top=False):
|
||||
"""Add nat rule in namespace.
|
||||
|
@ -27,6 +27,7 @@ class LibreSwanProcess(ipsec.OpenSwanProcess):
|
||||
|
||||
Libreswan needs nssdb initialised before running pluto daemon.
|
||||
"""
|
||||
# pylint: disable=useless-super-delegation
|
||||
def __init__(self, conf, process_id, vpnservice, namespace):
|
||||
super(LibreSwanProcess, self).__init__(conf, process_id,
|
||||
vpnservice, namespace)
|
||||
|
@ -91,6 +91,7 @@ class IPsecVpnAgentApi(service_drivers.BaseIPsecVpnAgentApi):
|
||||
|
||||
target = oslo_messaging.Target(version=BASE_IPSEC_VERSION)
|
||||
|
||||
# pylint: disable=useless-super-delegation
|
||||
def __init__(self, topic, default_version, driver):
|
||||
super(IPsecVpnAgentApi, self).__init__(
|
||||
topic, default_version, driver)
|
||||
|
@ -3,12 +3,11 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
|
||||
astroid<1.4.0 # LGPLv2.1 # breaks pylint 1.4.4
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
flake8-import-order==0.12 # LGPLv3
|
||||
mock>=2.0.0 # BSD
|
||||
pylint==1.4.5 # GPLv2
|
||||
pylint==1.7.6 # GPLv2
|
||||
requests-mock>=1.2.0 # Apache-2.0
|
||||
sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD
|
||||
openstackdocstheme>=1.18.1 # Apache-2.0
|
||||
|
8
tox.ini
8
tox.ini
@ -83,6 +83,14 @@ commands =
|
||||
{[testenv:genconfig]commands}
|
||||
whitelist_externals = sh
|
||||
|
||||
[testenv:pep8-dev]
|
||||
basepython = python3
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
{[testenv:dev]commands}
|
||||
{[testenv:pep8]commands}
|
||||
|
||||
[testenv:i18n]
|
||||
commands = python ./tools/check_i18n.py ./neutron-vpnaas ./tools/i18n_cfg.py
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user