diff options
author | John Snow | 2020-05-14 05:52:30 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé | 2020-05-31 18:25:07 +0200 |
commit | 2d110c11497ac52d5ce9f4b116463cdb8c3f4ad5 (patch) | |
tree | faf409f8ecaefb379907700e69938a5dfbe459fe /tests/docker | |
parent | scripts/qmp: Fix shebang and imports (diff) | |
download | qemu-2d110c11497ac52d5ce9f4b116463cdb8c3f4ad5.tar.gz qemu-2d110c11497ac52d5ce9f4b116463cdb8c3f4ad5.tar.xz qemu-2d110c11497ac52d5ce9f4b116463cdb8c3f4ad5.zip |
python: remove more instances of sys.version_info
We guarantee 3.5+ everywhere; remove more dead checks. In general, try
to avoid using version checks and instead prefer to attempt behavior
when possible.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200514035230.25756-1-jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'tests/docker')
-rwxr-xr-x | tests/docker/docker.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py index d8268c1111..5a9735db78 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -258,12 +258,13 @@ class Docker(object): return self._do_kill_instances(True) def _output(self, cmd, **kwargs): - if sys.version_info[1] >= 6: + try: return subprocess.check_output(self._command + cmd, stderr=subprocess.STDOUT, encoding='utf-8', **kwargs) - else: + except TypeError: + # 'encoding' argument was added in 3.6+ return subprocess.check_output(self._command + cmd, stderr=subprocess.STDOUT, **kwargs).decode('utf-8') |