summaryrefslogtreecommitdiffstats
path: root/tests/docker
diff options
context:
space:
mode:
authorAlex Bennée2019-09-04 19:46:36 +0200
committerAlex Bennée2019-09-10 10:38:33 +0200
commit884fcafc9ced4701fefa5d09f5f8db0f34c0d9b5 (patch)
tree27ad0a4a1ead1a4a71a7da66a878399e7754999c /tests/docker
parenttests/docker: fix "cc" command to work with podman (diff)
downloadqemu-884fcafc9ced4701fefa5d09f5f8db0f34c0d9b5.tar.gz
qemu-884fcafc9ced4701fefa5d09f5f8db0f34c0d9b5.tar.xz
qemu-884fcafc9ced4701fefa5d09f5f8db0f34c0d9b5.zip
tests/docker: handle missing encoding keyword for subprocess.check_output
This was only added in Python 3.6 and not all the build hosts have that recent a python3. However we still need to ensure everything is returns as a unicode string so checks higher up the call chain don't barf. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> fixup! tests/docker: handle missing encoding keyword for subprocess.check_output
Diffstat (limited to 'tests/docker')
-rwxr-xr-xtests/docker/docker.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 1620293ac8..417b0cdce1 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -258,10 +258,16 @@ class Docker(object):
return self._do_kill_instances(True)
def _output(self, cmd, **kwargs):
- return subprocess.check_output(self._command + cmd,
- stderr=subprocess.STDOUT,
- encoding='utf-8',
- **kwargs)
+ if sys.version_info[1] >= 6:
+ return subprocess.check_output(self._command + cmd,
+ stderr=subprocess.STDOUT,
+ encoding='utf-8',
+ **kwargs)
+ else:
+ return subprocess.check_output(self._command + cmd,
+ stderr=subprocess.STDOUT,
+ **kwargs).decode('utf-8')
+
def inspect_tag(self, tag):
try: