[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 13/32] tests/functional: switch over to using self.data_file(.
From: |
Daniel P . Berrangé |
Subject: |
[PATCH v3 13/32] tests/functional: switch over to using self.data_file(...) |
Date: |
Tue, 17 Dec 2024 15:59:34 +0000 |
This removes direct path manipulation to figure out the source dir
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/functional/test_acpi_bits.py | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/tests/functional/test_acpi_bits.py
b/tests/functional/test_acpi_bits.py
index 8763ea0822..59d0383563 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -38,7 +38,6 @@
import tarfile
import zipfile
-from pathlib import Path
from typing import (
List,
Optional,
@@ -119,7 +118,6 @@ class AcpiBitsTest(QemuSystemTest): #pylint:
disable=too-many-instance-attribute
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._vm = None
- self._baseDir = None
self._debugcon_addr = '0x403'
self._debugcon_log = 'debugcon-log.txt'
@@ -134,26 +132,22 @@ def _print_log(self, log):
def copy_bits_config(self):
""" copies the bios bits config file into bits.
"""
- config_file = 'bits-cfg.txt'
- bits_config_dir = os.path.join(self._baseDir, 'acpi-bits',
- 'bits-config')
+ bits_config_file = self.data_file('acpi-bits',
+ 'bits-config',
+ 'bits-cfg.txt')
target_config_dir = os.path.join(self.workdir,
'bits-%d' %self.BITS_INTERNAL_VER,
'boot')
- self.assertTrue(os.path.exists(bits_config_dir))
+ self.assertTrue(os.path.exists(bits_config_file))
self.assertTrue(os.path.exists(target_config_dir))
- self.assertTrue(os.access(os.path.join(bits_config_dir,
- config_file), os.R_OK))
- shutil.copy2(os.path.join(bits_config_dir, config_file),
- target_config_dir)
+ shutil.copy2(bits_config_file, target_config_dir)
self.logger.info('copied config file %s to %s',
- config_file, target_config_dir)
+ bits_config_file, target_config_dir)
def copy_test_scripts(self):
"""copies the python test scripts into bits. """
- bits_test_dir = os.path.join(self._baseDir, 'acpi-bits',
- 'bits-tests')
+ bits_test_dir = self.data_file('acpi-bits', 'bits-tests')
target_test_dir = os.path.join(self.workdir,
'bits-%d' %self.BITS_INTERNAL_VER,
'boot', 'python')
@@ -256,8 +250,6 @@ def setUp(self): # pylint: disable=arguments-differ
super().setUp()
self.logger = self.log
- self._baseDir = Path(__file__).parent
-
prebuiltDir = os.path.join(self.workdir, 'prebuilt')
if not os.path.isdir(prebuiltDir):
os.mkdir(prebuiltDir, mode=0o775)
--
2.46.0
- [PATCH v3 03/32] tests/functional: resolve str(Asset) to cache file path, (continued)
- [PATCH v3 03/32] tests/functional: resolve str(Asset) to cache file path, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 06/32] tests/functional: drop 'tesseract_available' helper, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 07/32] tests/functional: introduce some helpful decorators, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 08/32] tests/functional: switch to new test skip decorators, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 10/32] tests/functional: add helpers for building file paths, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 09/32] tests/functional: drop 'has_cmd' and 'has_cmds' helpers, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 11/32] tests/functional: switch over to using self.log_file(...), Daniel P . Berrangé, 2024/12/17
- [PATCH v3 12/32] tests/functional: switch over to using self.build_file(...), Daniel P . Berrangé, 2024/12/17
- [PATCH v3 13/32] tests/functional: switch over to using self.data_file(...),
Daniel P . Berrangé <=
- [PATCH v3 14/32] tests/functional: switch over to using self.scratch_file(), Daniel P . Berrangé, 2024/12/17
- [PATCH v3 17/32] tests/functional: move uncompress handling into new uncompress.py file, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 18/32] tests/functional: add common zip_extract helper, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 16/32] tests/functional: move archive handling into new archive.py file, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 20/32] tests/functional: let cpio_extract accept filenames, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 22/32] tests/functional: add 'archive_extract' to QemuBaseTest, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 23/32] tests/functional: convert tests to new archive_extract helper, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 15/32] tests/functional: remove redundant 'rmtree' call, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 19/32] tests/functional: add common deb_extract helper, Daniel P . Berrangé, 2024/12/17
- [PATCH v3 24/32] tests/functional: add a generalized uncompress helper, Daniel P . Berrangé, 2024/12/17