From beaf88c895a5eda649777757c80ab4171de777ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 17 Dec 2024 15:59:35 +0000 Subject: tests/functional: switch over to using self.scratch_file() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace any instances of os.path.join(self.workdir, ".../...") self.workdir + "/.../..." with self.scratch_file("...", "...") which is more compact and portable Reviewed-by: Thomas Huth Signed-off-by: Daniel P. Berrangé Message-ID: <20241217155953.3950506-15-berrange@redhat.com> Signed-off-by: Thomas Huth --- tests/functional/qemu_test/linuxkernel.py | 7 +++---- tests/functional/qemu_test/tuxruntest.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/functional/qemu_test') diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/qemu_test/linuxkernel.py index 2b5b9a5..2e4f4e3 100644 --- a/tests/functional/qemu_test/linuxkernel.py +++ b/tests/functional/qemu_test/linuxkernel.py @@ -46,8 +46,7 @@ class LinuxKernelTest(QemuSystemTest): os.chdir(cwd) # Return complete path to extracted file. Because callers to # extract_from_deb() specify 'path' with a leading slash, it is - # necessary to use os.path.relpath() as otherwise os.path.join() - # interprets it as an absolute path and drops the self.workdir part. - return os.path.normpath(os.path.join(self.workdir, - os.path.relpath(path, '/'))) + # necessary to use os.path.relpath() as otherwise scratch_file() + # interprets it as an absolute path and drops the required prefix + return os.path.normpath(self.scratch_file(os.path.relpath(path, '/'))) diff --git a/tests/functional/qemu_test/tuxruntest.py b/tests/functional/qemu_test/tuxruntest.py index 2e5c6d1..0b1bb8f 100644 --- a/tests/functional/qemu_test/tuxruntest.py +++ b/tests/functional/qemu_test/tuxruntest.py @@ -74,7 +74,7 @@ class TuxRunBaselineTest(QemuSystemTest): kernel_image = kernel_asset.fetch() disk_image_zst = rootfs_asset.fetch() - disk_image = self.workdir + "/rootfs.ext4" + disk_image = self.scratch_file("rootfs.ext4") run_cmd(['zstd', "-f", "-d", disk_image_zst, "-o", disk_image]) -- cgit v1.1