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.
pull/28364/head
Matt Clay 7 years ago committed by GitHub
parent e801187899
commit 8e0b5800b7

@ -568,7 +568,7 @@ files:
$modules/remote_management/hpilo/: dagwieers haad
$modules/remote_management/imc/: dagwieers
$modules/remote_management/ipmi/: cloudnull
$modules/remote_management/manageiq/ : $team_manageiq
$modules/remote_management/manageiq/: $team_manageiq
$modules/remote_management/stacki/stacki_host.py: bbyhuy bsanders
$modules/remote_management/wakeonlan.py: dagwieers
$modules/source_control/bzr.py: andreparames
@ -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)

@ -62,7 +62,7 @@ def do_fork():
return pid
# This is done as a 'good practice' for daemons, but we need to keep the cwd
# leaving it here as a note that we KNOW its good practice but are not doing it on purpose.
#os.chdir("/")
# os.chdir("/")
os.setsid()
os.umask(0)
@ -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:
@ -304,7 +305,7 @@ def main():
socket_path = unfrackpath(cp % dict(directory=tmp_path))
# if the socket file doesn't exist, spin up the daemon process
lock_fd = os.open(lock_path, os.O_RDWR|os.O_CREAT, 0o600)
lock_fd = os.open(lock_path, os.O_RDWR | os.O_CREAT, 0o600)
fcntl.lockf(lock_fd, fcntl.LOCK_EX)
if not os.path.exists(socket_path):

@ -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…
Cancel
Save