Fix E265 errors in tacker code

This Patch fixes all E265 errors and
enables this test for all new patches to tacker.

E265 block comment should start with ‘# ‘

see OpenStack Style Guidelines
http://docs.openstack.org/developer/hacking/

Change-Id: I4b1234fab420174d99b2c13a5b25c1f7c5d4909f
Related-Bug: 1515930
This commit is contained in:
Martin Oemke 2016-01-05 13:19:31 +01:00
parent 81a9262be3
commit 456650d663
14 changed files with 42 additions and 43 deletions

View File

@ -30,7 +30,7 @@ import sqlalchemy as sa
def upgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
# commands auto generated by Alembic - please adjust! #
op.create_table(
'servicetypes',
sa.Column('tenant_id', sa.String(length=255), nullable=True),
@ -95,14 +95,14 @@ def upgrade(active_plugins=None, options=None):
sa.PrimaryKeyConstraint('service_instance_id', 'device_id'),
mysql_engine='InnoDB'
)
### end Alembic commands ###
# end Alembic commands #
def downgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
# commands auto generated by Alembic - please adjust! #
op.drop_table('servicedevicebindings')
op.drop_table('servicecontexts')
op.drop_table('serviceinstances')
op.drop_table('deviceservicecontexts')
op.drop_table('servicetypes')
### end Alembic commands ###
# end Alembic commands #

View File

@ -30,22 +30,22 @@ from sqlalchemy.dialects import mysql
def upgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
# commands auto generated by Alembic - please adjust! #
op.alter_column(u'deviceattributes', 'device_id',
existing_type=mysql.VARCHAR(length=255),
nullable=False)
op.alter_column(u'devices', 'status',
existing_type=mysql.VARCHAR(length=255),
nullable=False)
### end Alembic commands ###
# end Alembic commands #
def downgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
# commands auto generated by Alembic - please adjust! #
op.alter_column(u'devices', 'status',
existing_type=mysql.VARCHAR(length=255),
nullable=True)
op.alter_column(u'deviceattributes', 'device_id',
existing_type=mysql.VARCHAR(length=255),
nullable=True)
### end Alembic commands ###
# end Alembic commands #

View File

@ -31,16 +31,16 @@ from sqlalchemy.dialects import mysql
def upgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
# commands auto generated by Alembic - please adjust! #
op.drop_table('servicecontexts')
op.drop_table('deviceservicecontexts')
op.drop_table('servicedevicebindings')
op.drop_table('serviceinstances')
### end Alembic commands ###
# end Alembic commands #
def downgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
# commands auto generated by Alembic - please adjust! #
op.create_table(
'deviceservicecontexts',
sa.Column('id', mysql.VARCHAR(length=36), nullable=False),
@ -112,4 +112,4 @@ def downgrade(active_plugins=None, options=None):
mysql_default_charset=u'utf8',
mysql_engine=u'InnoDB'
)
### end Alembic commands ###
# end Alembic commands #

View File

@ -149,5 +149,5 @@ def main():
config.tacker_config = CONF
CONF()
#TODO(gongysh) enable logging
# TODO(gongysh) enable logging
CONF.command.func(config, CONF.command.name)

View File

@ -81,7 +81,7 @@ class BaseTestCase(testtools.TestCase):
if check_plugin_deallocation:
gc.collect()
#TODO(marun) Ensure that mocks are deallocated?
# TODO(marun) Ensure that mocks are deallocated?
if plugin() and not isinstance(plugin(), mock.Base):
self.fail('The plugin for this test was not deallocated.')

View File

@ -30,11 +30,11 @@ class VnfTestCreate(base.BaseTackerTest):
toscal = data['tosca']
tosca_arg = {'vnfd': {'attributes': {'vnfd': toscal}}}
##Create vnfd with tosca template
# Create vnfd with tosca template
vnfd_instance = self.client.create_vnfd(body=tosca_arg)
self.assertIsNotNone(vnfd_instance)
##Create vnf with vnfd_id
# Create vnf with vnfd_id
vnfd_id = vnfd_instance['vnfd']['id']
vnf_name = 'test_vnf_with_cirros_no_monitoring'
vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name': vnf_name}}
@ -49,13 +49,13 @@ class VnfTestCreate(base.BaseTackerTest):
self.assertEqual(vnf_current_status, 'ACTIVE')
self.assertIsNotNone(self.client.show_vnf(vnf_id)['vnf']['mgmt_url'])
##Delete vnf_instance with vnf_id
# Delete vnf_instance with vnf_id
try:
self.client.delete_vnf(vnf_id)
except Exception:
assert False, "vnf Delete failed"
##Delete vnfd_instance
# Delete vnfd_instance
try:
self.client.delete_vnfd(vnfd_id)
except Exception:

View File

@ -24,19 +24,19 @@ class VnfTestPingMonitor(base.BaseTackerTest):
toscal = data['tosca']
tosca_arg = {'vnfd': {'attributes': {'vnfd': toscal}}}
#Create vnfd with tosca template
# Create vnfd with tosca template
vnfd_instance = self.client.create_vnfd(body=tosca_arg)
self.assertIsNotNone(vnfd_instance)
##Create vnf with vnfd_id
# Create vnf with vnfd_id
vnfd_id = vnfd_instance['vnfd']['id']
vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name': vnf_name}}
vnf_instance = self.client.create_vnf(body=vnf_arg)
##Verify vnf goes from ACTIVE->DEAD->ACTIVE states
# Verify vnf goes from ACTIVE->DEAD->ACTIVE states
self.verify_vnf_restart(vnfd_instance, vnf_instance)
##Delete vnf_instance with vnf_id
# Delete vnf_instance with vnf_id
vnf_id = vnf_instance['vnf']['id']
try:
self.client.delete_vnf(vnf_id)
@ -44,7 +44,7 @@ class VnfTestPingMonitor(base.BaseTackerTest):
assert False, ("Failed to delete vnf %s after the monitor test" %
vnf_id)
##Delete vnfd_instance
# Delete vnfd_instance
try:
self.client.delete_vnfd(vnfd_id)
except Exception:

View File

@ -31,11 +31,11 @@ class VnfTestMultipleVDU(base.BaseTackerTest):
toscal = data['tosca']
tosca_arg = {'vnfd': {'attributes': {'vnfd': toscal}}}
##Create vnfd with tosca template
# Create vnfd with tosca template
vnfd_instance = self.client.create_vnfd(body=tosca_arg)
self.assertIsNotNone(vnfd_instance)
##Create vnf with vnfd_id
# Create vnf with vnfd_id
vnfd_id = vnfd_instance['vnfd']['id']
vnf_arg = {'vnf': {'vnfd_id': vnfd_id, 'name':
"test_vnf_with_multiple_vdus"}}
@ -49,7 +49,7 @@ class VnfTestMultipleVDU(base.BaseTackerTest):
'ACTIVE')
self.validate_vnf_instance(vnfd_instance, vnf_instance)
##Validate mgmt_url with input yaml file
# Validate mgmt_url with input yaml file
mgmt_url = self.client.show_vnf(vnf_id)['vnf']['mgmt_url']
self.assertIsNotNone(mgmt_url)
mgmt_dict = yaml.load(str(mgmt_url))
@ -60,13 +60,13 @@ class VnfTestMultipleVDU(base.BaseTackerTest):
self.assertIsNotNone(mgmt_dict[vdu])
self.assertEqual(True, utils.is_valid_ipv4(mgmt_dict[vdu]))
##Delete vnf_instance with vnf_id
# Delete vnf_instance with vnf_id
try:
self.client.delete_vnf(vnf_id)
except Exception:
assert False, "vnf Delete of test_vnf_with_multiple_vdus failed"
##Delete vnfd_instance
# Delete vnfd_instance
try:
self.client.delete_vnfd(vnfd_id)
except Exception:

View File

@ -34,7 +34,7 @@ class VnfmTestParam(base.BaseTackerTest):
return vnfd_instance
def _test_vnfd_delete(self, vnfd_instance):
#Delete vnfd
# Delete vnfd
vnfd_id = vnfd_instance['vnfd']['id']
self.assertIsNotNone(vnfd_id)
try:
@ -51,7 +51,7 @@ class VnfmTestParam(base.BaseTackerTest):
vnfd_id = vnfd_instance['vnfd']['id']
values_str = read_file(vnf_value_file)
#create vnf with values file
# Create vnf with values file
vnf_dict = dict()
vnf_dict = {'vnf': {'vnfd_id': vnfd_id, 'name': vnf_name,
'attributes': {'param_values': values_str}}}

View File

@ -77,7 +77,7 @@ class Foxinsocks(object):
request_exts = []
def _goose_handler(req, res):
#NOTE: This only handles JSON responses.
# NOTE: This only handles JSON responses.
# You can use content type header to test for XML.
data = jsonutils.loads(res.body)
data['FOXNSOX:googoose'] = req.GET.get('chewing')
@ -89,7 +89,7 @@ class Foxinsocks(object):
request_exts.append(req_ext1)
def _bands_handler(req, res):
#NOTE: This only handles JSON responses.
# NOTE: This only handles JSON responses.
# You can use content type header to test for XML.
data = jsonutils.loads(res.body)
data['FOXNSOX:big_bands'] = 'Pig Bands!'

View File

@ -57,7 +57,7 @@ class ExtensionTestCase(testlib_api.WebTestCase):
# Create the default configurations
self.config_parse()
#just stubbing core plugin with plugin
# just stubbing core plugin with plugin
self.setup_coreplugin(plugin)
cfg.CONF.set_override('core_plugin', plugin)
if service_type:

View File

@ -23,7 +23,7 @@ SVC_TYPE_ROUTER = 'router'
SVC_TYPE_LOADBALANCER = 'loadbalancer'
# attribute key for service to spin up device
## for nova driver. novaclient library uses those
# for nova driver. novaclient library uses those
ATTR_KEY_IMAGE = 'image'
ATTR_KEY_FLAVOR = 'flavor'
ATTR_KEY_MGMT_NETWORK = 'mgmt-network'

View File

@ -30,7 +30,7 @@ from xml.etree import ElementTree as etree
from xml.parsers import expat
import eventlet.wsgi
#eventlet.patcher.monkey_patch(all=False, socket=True, thread=True)
# eventlet.patcher.monkey_patch(all=False, socket=True, thread=True)
from oslo_config import cfg
import routes.middleware
import webob.dec
@ -329,13 +329,13 @@ class Request(webob.Request):
if _format in ['json', 'xml']:
return 'application/{0}'.format(_format)
#Then look up content header
# Then look up content header
type_from_header = self.get_content_type()
if type_from_header:
return type_from_header
ctypes = ['application/json', 'application/xml']
#Finally search in Accept-* headers
# Finally search in Accept-* headers
bm = self.accept.best_match(ctypes)
return bm or 'application/json'
@ -459,7 +459,7 @@ class XMLDictSerializer(DictSerializer):
self._add_xmlns(node, used_prefixes, has_atom)
return etree.tostring(node, encoding='UTF-8')
#NOTE (ameade): the has_atom should be removed after all of the
# NOTE (ameade): the has_atom should be removed after all of the
# xml serializers and view builders have been updated to the current
# spec that required all responses include the xmlns:atom, the has_atom
# flag is to prevent current tests from breaking
@ -482,7 +482,7 @@ class XMLDictSerializer(DictSerializer):
result = etree.SubElement(parent, nodename)
if ":" in nodename:
used_prefixes.append(nodename.split(":", 1)[0])
#TODO(bcwaldon): accomplish this without a type-check
# TODO(bcwaldon): accomplish this without a type-check
if isinstance(data, list):
if not data:
result.set(
@ -498,7 +498,7 @@ class XMLDictSerializer(DictSerializer):
for item in data:
self._to_xml_node(result, metadata, singular, item,
used_prefixes)
#TODO(bcwaldon): accomplish this without a type-check
# TODO(bcwaldon): accomplish this without a type-check
elif isinstance(data, dict):
if not data:
result.set(
@ -1124,7 +1124,7 @@ class Resource(Application):
controller_method = getattr(self.controller, action)
try:
#NOTE(salvatore-orlando): the controller method must have
# NOTE(salvatore-orlando): the controller method must have
# an argument whose name is 'request'
return controller_method(request=request, **action_args)
except TypeError as exc:

View File

@ -59,12 +59,11 @@ commands = {posargs}
# E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line
# E265 block comment should start with #
# E713 test for membership should be not in
# F811 redefinition of unused variable
# H302 import only modules
# H904 Wrap long lines in parentheses instead of a backslash
ignore = E125,E126,E128,E129,E265,E713,F811,H302,H904
ignore = E125,E126,E128,E129,E713,F811,H302,H904
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject