[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/38] tests/functional: switch over to using self.log_file(...)
From: |
Thomas Huth |
Subject: |
[PULL 11/38] tests/functional: switch over to using self.log_file(...) |
Date: |
Wed, 18 Dec 2024 12:09:31 +0100 |
From: Daniel P. Berrangé <berrange@redhat.com>
This removes direct access of the 'self.logdir' variable.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-12-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/qemu_test/testcase.py | 9 ++++-----
tests/functional/test_virtio_gpu.py | 4 +---
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/tests/functional/qemu_test/testcase.py
b/tests/functional/qemu_test/testcase.py
index 89425b737c..2174fbb155 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -126,7 +126,7 @@ def scratch_file(self, *args):
Returns: string representing a file path
'''
def log_file(self, *args):
- return str(Path(self.logdir, *args))
+ return str(Path(self.outputdir, *args))
def setUp(self, bin_prefix):
self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be
set')
@@ -138,8 +138,7 @@ def setUp(self, bin_prefix):
self.workdir = os.path.join(self.outputdir, 'scratch')
os.makedirs(self.workdir, exist_ok=True)
- self.logdir = self.outputdir
- self.log_filename = os.path.join(self.logdir, 'base.log')
+ self.log_filename = self.log_file('base.log')
self.log = logging.getLogger('qemu-test')
self.log.setLevel(logging.DEBUG)
self._log_fh = logging.FileHandler(self.log_filename, mode='w')
@@ -215,7 +214,7 @@ def setUp(self):
console_log = logging.getLogger('console')
console_log.setLevel(logging.DEBUG)
- self.console_log_name = os.path.join(self.logdir, 'console.log')
+ self.console_log_name = self.log_file('console.log')
self._console_log_fh = logging.FileHandler(self.console_log_name,
mode='w')
self._console_log_fh.setLevel(logging.DEBUG)
@@ -269,7 +268,7 @@ def _new_vm(self, name, *args):
vm = QEMUMachine(self.qemu_bin,
name=name,
base_temp_dir=self.workdir,
- log_dir=self.logdir)
+ log_dir=self.log_file())
self.log.debug('QEMUMachine "%s" created', name)
self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir)
diff --git a/tests/functional/test_virtio_gpu.py
b/tests/functional/test_virtio_gpu.py
index 2d298b1f02..7654421e6b 100755
--- a/tests/functional/test_virtio_gpu.py
+++ b/tests/functional/test_virtio_gpu.py
@@ -100,9 +100,7 @@ def test_vhost_user_vga_virgl(self):
os.set_inheritable(qemu_sock.fileno(), True)
os.set_inheritable(vug_sock.fileno(), True)
- self._vug_log_path = os.path.join(
- self.logdir, "vhost-user-gpu.log"
- )
+ self._vug_log_path = self.log_file("vhost-user-gpu.log")
self._vug_log_file = open(self._vug_log_path, "wb")
self.log.info('Complete vhost-user-gpu.log file can be '
'found at %s', self._vug_log_path)
--
2.47.1
- [PULL 01/38] tests/functional: add execute permission to aspeed tests, (continued)
- [PULL 01/38] tests/functional: add execute permission to aspeed tests, Thomas Huth, 2024/12/18
- [PULL 02/38] tests/functional: remove many unused imports, Thomas Huth, 2024/12/18
- [PULL 03/38] tests/functional: resolve str(Asset) to cache file path, Thomas Huth, 2024/12/18
- [PULL 05/38] tests/functional: simplify 'which' implementation, Thomas Huth, 2024/12/18
- [PULL 04/38] tests/functional: remove duplicated 'which' function impl, Thomas Huth, 2024/12/18
- [PULL 06/38] tests/functional: drop 'tesseract_available' helper, Thomas Huth, 2024/12/18
- [PULL 07/38] tests/functional: introduce some helpful decorators, Thomas Huth, 2024/12/18
- [PULL 08/38] tests/functional: switch to new test skip decorators, Thomas Huth, 2024/12/18
- [PULL 10/38] tests/functional: add helpers for building file paths, Thomas Huth, 2024/12/18
- [PULL 09/38] tests/functional: drop 'has_cmd' and 'has_cmds' helpers, Thomas Huth, 2024/12/18
- [PULL 11/38] tests/functional: switch over to using self.log_file(...),
Thomas Huth <=
- [PULL 12/38] tests/functional: switch over to using self.build_file(...), Thomas Huth, 2024/12/18
- [PULL 13/38] tests/functional: switch over to using self.data_file(...), Thomas Huth, 2024/12/18
- [PULL 15/38] tests/functional: remove redundant 'rmtree' call, Thomas Huth, 2024/12/18
- [PULL 16/38] tests/functional: move archive handling into new archive.py file, Thomas Huth, 2024/12/18
- [PULL 17/38] tests/functional: move uncompress handling into new uncompress.py file, Thomas Huth, 2024/12/18
- [PULL 14/38] tests/functional: switch over to using self.scratch_file(), Thomas Huth, 2024/12/18
- [PULL 18/38] tests/functional: add common zip_extract helper, Thomas Huth, 2024/12/18
- [PULL 20/38] tests/functional: let cpio_extract accept filenames, Thomas Huth, 2024/12/18
- [PULL 19/38] tests/functional: add common deb_extract helper, Thomas Huth, 2024/12/18
- [PULL 21/38] tests/functional: add a generalized archive_extract, Thomas Huth, 2024/12/18