Fix issues reported by the latest pylint.

(cherry picked from commit 4db054364a)

See: https://github.com/ansible/ansible/pull/47036/
pull/47948/head
Matt Clay 6 years ago
parent 71ad7da2f8
commit a59c0dca2d

@ -117,7 +117,7 @@ class AnsibleCoreCI(object):
region = 'us-east-1'
self.path = "%s-%s" % (self.path, region)
self.endpoints = AWS_ENDPOINTS[region],
self.endpoints = (AWS_ENDPOINTS[region],)
self.ssh_key = SshKey(args)
if self.platform == 'windows':
@ -192,7 +192,7 @@ class AnsibleCoreCI(object):
if self.started:
display.info('Skipping started %s/%s instance %s.' % (self.platform, self.version, self.instance_id),
verbosity=1)
return
return None
if is_shippable():
return self.start_shippable()

@ -117,7 +117,7 @@ def delegate_tox(args, exclude, require, integration_targets):
:type integration_targets: tuple[IntegrationTarget]
"""
if args.python:
versions = args.python_version,
versions = (args.python_version,)
if args.python_version not in SUPPORTED_PYTHON_VERSIONS:
raise ApplicationError('tox does not support Python version %s' % args.python_version)

@ -99,7 +99,7 @@ class PylintTest(SanitySingleVersion):
invalid_ignores.append((line, 'Invalid version: %s' % version))
continue
if version != args.python_version and version != args.python_version.split('.')[0]:
if version not in (args.python_version, args.python_version.split('.')[0]):
continue # ignore version specific entries for other versions
ignore[path][code] = line
@ -121,12 +121,26 @@ class PylintTest(SanitySingleVersion):
contexts[context_name] = sorted(filtered_paths)
available_paths -= filtered_paths
add_context(remaining_paths, 'ansible-test', lambda p: p.startswith('test/runner/'))
add_context(remaining_paths, 'units', lambda p: p.startswith('test/units/'))
add_context(remaining_paths, 'test', lambda p: p.startswith('test/'))
add_context(remaining_paths, 'hacking', lambda p: p.startswith('hacking/'))
add_context(remaining_paths, 'modules', lambda p: p.startswith('lib/ansible/modules/'))
add_context(remaining_paths, 'module_utils', lambda p: p.startswith('lib/ansible/module_utils/'))
def filter_path(path_filter=None):
"""
:type path_filter: str
:rtype: (str) -> bool
"""
def context_filter(path_to_filter):
"""
:type path_to_filter: str
:rtype: bool
"""
return path_to_filter.startswith(path_filter)
return context_filter
add_context(remaining_paths, 'ansible-test', filter_path('test/runner/'))
add_context(remaining_paths, 'units', filter_path('test/units/'))
add_context(remaining_paths, 'test', filter_path('test/'))
add_context(remaining_paths, 'hacking', filter_path('hacking/'))
add_context(remaining_paths, 'modules', filter_path('lib/ansible/modules/'))
add_context(remaining_paths, 'module_utils', filter_path('lib/ansible/module_utils/'))
add_context(remaining_paths, 'ansible', lambda p: True)
messages = []

@ -448,7 +448,7 @@ class TestTarget(CompletionTarget):
if module_path and path.startswith(module_path) and name != '__init__' and ext in MODULE_EXTENSIONS:
self.module = name[len(module_prefix or ''):].lstrip('_')
self.modules = self.module,
self.modules = (self.module,)
else:
self.module = None
self.modules = tuple()

Loading…
Cancel
Save