Fix ansible-test encoding issues.

This fixes `ansible-test sanity --list-tests` which was failing when `LC_ALL=C` was set.
pull/58954/head
Matt Clay 5 years ago
parent db7e9aa051
commit cf9999692a

@ -15,6 +15,7 @@ from lib.util import (
read_lines_without_comments, read_lines_without_comments,
is_subdir, is_subdir,
to_text, to_text,
to_bytes,
) )
from lib.data import ( from lib.data import (
@ -257,7 +258,7 @@ def walk_test_targets(path=None, module_path=None, extensions=None, prefix=None,
if prefix and not name.startswith(prefix): if prefix and not name.startswith(prefix):
continue continue
if os.path.islink(file_path): if os.path.islink(to_bytes(file_path)):
# special case to allow a symlink of ansible_release.py -> ../release.py # special case to allow a symlink of ansible_release.py -> ../release.py
if file_path != 'lib/ansible/module_utils/ansible_release.py': if file_path != 'lib/ansible/module_utils/ansible_release.py':
continue continue
@ -272,7 +273,7 @@ def walk_test_targets(path=None, module_path=None, extensions=None, prefix=None,
file_paths.append(file_path) file_paths.append(file_path)
for file_path in file_paths: for file_path in file_paths:
if os.path.islink(file_path): if os.path.islink(to_bytes(file_path)):
continue continue
yield TestTarget(file_path, module_path, prefix, path) yield TestTarget(file_path, module_path, prefix, path)

Loading…
Cancel
Save