This helper wrappers utils.uncompress, forcing the use of the scratch
directory, to ensure any uncompressed files are cleaned at test
termination.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/functional/qemu_test/testcase.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index 31d06f0172..5c088a2442 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -29,7 +29,8 @@
from .cmd import run_cmd
from .config import BUILD_DIR
from .utils import (archive_extract as utils_archive_extract,
- guess_archive_format)
+ uncompress as utils_uncompress,
+ guess_archive_format, guess_uncompress_format)
class QemuBaseTest(unittest.TestCase):
@@ -41,6 +42,21 @@ class QemuBaseTest(unittest.TestCase):
log = None
logdir = None
+ def uncompress(self, input_path, format=None):
+ if type(input_path) == Asset:
+ if format is None:
+ format = guess_uncompress_format(input_path.url)
+ input_path = input_path.fetch()
+ elif format is None:
+ format = guess_uncompress_format(input_path)
+
+ (name, ext) = os.path.splitext(input_path)
+ output_path = self.scratch_file(os.path.basename(name))
+
+ utils_uncompress(input_path, output_path)
+
+ return output_path
+
'''
@params archive: filename, Asset, or file-like object to extract
@params sub_dir: optional sub-directory to extract into
--
2.46.0