From eb427e2513aa4bb1d3d184ecac05592b5f768ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Tue, 25 Apr 2023 12:09:39 +0200 Subject: [PATCH] Don't use `capture_output=True` with `subprocess.run()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `capture_output` argument does not exist on Python 3.6 used by default on RHEL-8. Signed-off-by: Tomáš Hozza --- test/run/test_mount.py | 2 +- test/run/test_stages.py | 4 ++-- tools/osbuild-mpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/run/test_mount.py b/test/run/test_mount.py index 634fba1c..939add64 100755 --- a/test/run/test_mount.py +++ b/test/run/test_mount.py @@ -163,7 +163,7 @@ def test_all_options(tmpdir): assert st.st_gid == 0 shortname_tested = False - proc = subprocess.run("mount", capture_output=True, check=True) + proc = subprocess.run("mount", stdout=subprocess.PIPE, check=True) for line in proc.stdout.splitlines(): strline = line.decode("utf-8") if mountpoint in strline: diff --git a/test/run/test_stages.py b/test/run/test_stages.py index 8ff0b62a..476625d6 100644 --- a/test/run/test_stages.py +++ b/test/run/test_stages.py @@ -325,7 +325,7 @@ class TestStages(test.TestBase): qemu_img_run = subprocess.run( ["qemu-img", "info", "--output=json", ip], - capture_output=True, + stdout=subprocess.PIPE, check=True, encoding="utf8" ) @@ -490,7 +490,7 @@ class TestStages(test.TestBase): assert ovf_tree_file.attrib["{http://schemas.dmtf.org/ovf/envelope/1}size"] == str(os.stat(vmdk).st_size) ovf_tree_disk = ovf_tree_root[1][1] - res = subprocess.run(["qemu-img", "info", "--output=json", vmdk], check=True, capture_output=True) + res = subprocess.run(["qemu-img", "info", "--output=json", vmdk], check=True, stdout=subprocess.PIPE) capacity = ovf_tree_disk.attrib["{http://schemas.dmtf.org/ovf/envelope/1}capacity"] assert capacity == str(json.loads(res.stdout)["virtual-size"]) pop_size = ovf_tree_disk.attrib["{http://schemas.dmtf.org/ovf/envelope/1}populatedSize"] diff --git a/tools/osbuild-mpp b/tools/osbuild-mpp index 8ac86346..81e4f654 100755 --- a/tools/osbuild-mpp +++ b/tools/osbuild-mpp @@ -360,7 +360,7 @@ class ImageManifest: src = f"docker://{imagename}" res = subprocess.run(["skopeo", "inspect", "--raw", src], - capture_output=True, + stdout=subprocess.PIPE, check=True) m = ImageManifest(res.stdout) m.name = imagename