summary refs log tree commit diff stats
path: root/tests/functional/qemu_test/testcase.py
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2024-12-17 15:59:32 +0000
committerThomas Huth <thuth@redhat.com>2024-12-17 19:39:53 +0100
commitbcc12768c242a4862a1725e22371dd87af1c2b7e (patch)
treed7def83a641ff08b9c1900b9dca2b30913e96b39 /tests/functional/qemu_test/testcase.py
parentf84f8e71eb4bdd193e89c6550a015277b686b0af (diff)
downloadfocaccia-qemu-bcc12768c242a4862a1725e22371dd87af1c2b7e.tar.gz
focaccia-qemu-bcc12768c242a4862a1725e22371dd87af1c2b7e.zip
tests/functional: switch over to using self.log_file(...)
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>
Diffstat (limited to 'tests/functional/qemu_test/testcase.py')
-rw-r--r--tests/functional/qemu_test/testcase.py9
1 files changed, 4 insertions, 5 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 @@ class QemuBaseTest(unittest.TestCase):
     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 @@ class QemuBaseTest(unittest.TestCase):
         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 @@ class QemuSystemTest(QemuBaseTest):
 
         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 @@ class QemuSystemTest(QemuBaseTest):
         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)