From dca4eb3dcd05f30c75297acf800b1013fadc27c3 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 11 Jan 2019 14:37:35 -0800 Subject: [PATCH] Delegate ansible-test with LC_ALL=en_US.UTF-8. This fixes encoding issues in ansible-test when running tests in delegated environments that do not have LC_ALL or LANG set by default. --- test/runner/lib/delegation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/runner/lib/delegation.py b/test/runner/lib/delegation.py index c0098cb4a44..d87830fafd8 100644 --- a/test/runner/lib/delegation.py +++ b/test/runner/lib/delegation.py @@ -432,6 +432,13 @@ def generate_command(args, path, options, exclude, require): options['--color'] = 1 cmd = [path] + + # Force the encoding used during delegation. + # This is only needed because ansible-test relies on Python's file system encoding. + # Environments that do not have the locale configured are thus unable to work with unicode file paths. + # Examples include FreeBSD and some Linux containers. + cmd = ['/usr/bin/env', 'LC_ALL=en_US.UTF-8'] + cmd + cmd += list(filter_options(args, sys.argv[1:], options, exclude, require)) cmd += ['--color', 'yes' if args.color else 'no']