Miscellaneous ansible-test fixes. (#28355)
* Include .github in test targets. Fix BOTMETA.yml. * Include bin in compile tests. * Exclude links from test targets. * Include bin in pep8 and pylint tests. * Fix pep8 and pylint issues in bin dir.
This commit is contained in:
parent
e801187899
commit
8e0b5800b7
5 changed files with 27 additions and 13 deletions
3
.github/BOTMETA.yml
vendored
3
.github/BOTMETA.yml
vendored
|
@ -903,9 +903,6 @@ files:
|
|||
$module_utils/dellos:
|
||||
maintainers: skg-net
|
||||
labels: networking
|
||||
$module_utils/eos.py:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
$module_utils/f5_utils.py:
|
||||
maintainers: caphrim007
|
||||
labels: networking
|
||||
|
|
|
@ -44,7 +44,7 @@ from ansible.module_utils._text import to_text
|
|||
|
||||
|
||||
########################################
|
||||
### OUTPUT OF LAST RESORT ###
|
||||
# OUTPUT OF LAST RESORT
|
||||
class LastResort(object):
|
||||
def display(self, msg):
|
||||
print(msg, file=sys.stderr)
|
||||
|
|
|
@ -261,6 +261,7 @@ def communicate(sock, data):
|
|||
stderr = recv_data(sock)
|
||||
return (rc, stdout, stderr)
|
||||
|
||||
|
||||
def main():
|
||||
# Need stdin as a byte stream
|
||||
if PY3:
|
||||
|
|
|
@ -315,7 +315,7 @@ def command_sanity_pep8(args, targets):
|
|||
skip_paths_set = set(skip_paths)
|
||||
legacy_paths_set = set(legacy_paths)
|
||||
|
||||
paths = sorted(i.path for i in targets.include if os.path.splitext(i.path)[1] == '.py' and i.path not in skip_paths_set)
|
||||
paths = sorted(i.path for i in targets.include if (os.path.splitext(i.path)[1] == '.py' or i.path.startswith('bin/')) and i.path not in skip_paths_set)
|
||||
|
||||
if not paths:
|
||||
return SanitySkipped(test)
|
||||
|
@ -458,7 +458,7 @@ def command_sanity_pylint(args, targets):
|
|||
|
||||
skip_paths_set = set(skip_paths)
|
||||
|
||||
paths = sorted(i.path for i in targets.include if os.path.splitext(i.path)[1] == '.py' and i.path not in skip_paths_set)
|
||||
paths = sorted(i.path for i in targets.include if (os.path.splitext(i.path)[1] == '.py' or i.path.startswith('bin/')) and i.path not in skip_paths_set)
|
||||
|
||||
if not paths:
|
||||
return SanitySkipped(test)
|
||||
|
|
|
@ -209,7 +209,7 @@ def walk_compile_targets():
|
|||
"""
|
||||
:rtype: collections.Iterable[TestTarget]
|
||||
"""
|
||||
return walk_test_targets(module_path='lib/ansible/modules/', extensions=('.py',))
|
||||
return walk_test_targets(module_path='lib/ansible/modules/', extensions=('.py',), extra_dirs=('bin',))
|
||||
|
||||
|
||||
def walk_sanity_targets():
|
||||
|
@ -276,12 +276,13 @@ def load_integration_prefixes():
|
|||
return prefixes
|
||||
|
||||
|
||||
def walk_test_targets(path=None, module_path=None, extensions=None, prefix=None):
|
||||
def walk_test_targets(path=None, module_path=None, extensions=None, prefix=None, extra_dirs=None):
|
||||
"""
|
||||
:type path: str | None
|
||||
:type module_path: str | None
|
||||
:type extensions: tuple[str] | None
|
||||
:type prefix: str | None
|
||||
:type extra_dirs: tuple[str] | None
|
||||
:rtype: collections.Iterable[TestTarget]
|
||||
"""
|
||||
for root, _, file_names in os.walk(path or '.', topdown=False):
|
||||
|
@ -294,7 +295,7 @@ def walk_test_targets(path=None, module_path=None, extensions=None, prefix=None)
|
|||
if path is None:
|
||||
root = root[2:]
|
||||
|
||||
if root.startswith('.'):
|
||||
if root.startswith('.') and root != '.github':
|
||||
continue
|
||||
|
||||
for file_name in file_names:
|
||||
|
@ -309,7 +310,22 @@ def walk_test_targets(path=None, module_path=None, extensions=None, prefix=None)
|
|||
if prefix and not name.startswith(prefix):
|
||||
continue
|
||||
|
||||
yield TestTarget(os.path.join(root, file_name), module_path, prefix, path)
|
||||
file_path = os.path.join(root, file_name)
|
||||
|
||||
if os.path.islink(file_path):
|
||||
continue
|
||||
|
||||
yield TestTarget(file_path, module_path, prefix, path)
|
||||
|
||||
if extra_dirs:
|
||||
for extra_dir in extra_dirs:
|
||||
file_names = os.listdir(extra_dir)
|
||||
|
||||
for file_name in file_names:
|
||||
file_path = os.path.join(extra_dir, file_name)
|
||||
|
||||
if os.path.isfile(file_path) and not os.path.islink(file_path):
|
||||
yield TestTarget(file_path, module_path, prefix, path)
|
||||
|
||||
|
||||
def analyze_integration_target_dependencies(integration_targets):
|
||||
|
|
Loading…
Reference in a new issue