From 0ff5815a4f48c0c4e6e457ee428f081bde4eb92b Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 15 Aug 2017 15:05:31 -0700 Subject: [PATCH] Fix ansible-test target completion on Python 3. --- test/runner/lib/target.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/runner/lib/target.py b/test/runner/lib/target.py index da8a3f5081..9aee95dcb0 100644 --- a/test/runner/lib/target.py +++ b/test/runner/lib/target.py @@ -7,6 +7,7 @@ import re import errno import itertools import abc +import sys from lib.util import ApplicationError @@ -21,7 +22,8 @@ def find_target_completion(target_func, prefix): """ try: targets = target_func() - prefix = prefix.encode() + if sys.version_info[0] == 2: + prefix = prefix.encode() short = os.environ.get('COMP_TYPE') == '63' # double tab completion from bash matches = walk_completion_targets(targets, prefix, short) return matches