diff mbox series

[v3] tests/functional: remove all class level fields

Message ID 20250317124300.84266-1-berrange@redhat.com (mailing list archive)
State New
Headers show
Series [v3] tests/functional: remove all class level fields | expand

Commit Message

Daniel P. Berrangé March 17, 2025, 12:43 p.m. UTC
A number of fields are set at the class level on QemuBaseTest, even
though the exact same named field is then set at the object level
later in most cases.

The 'self.logger' initialization in ACPI bits test needs to be removed
since 'self.log' won't exist at that point in the flow. It already
initialized 'self.logger' later in the setUp() method, so the __init__
method was redundant.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/functional/qemu_test/testcase.py | 6 ------
 tests/functional/test_acpi_bits.py     | 1 -
 2 files changed, 7 deletions(-)

Comments

Thomas Huth March 17, 2025, 1:11 p.m. UTC | #1
On 17/03/2025 13.43, Daniel P. Berrangé wrote:
> A number of fields are set at the class level on QemuBaseTest, even
> though the exact same named field is then set at the object level
> later in most cases.
> 
> The 'self.logger' initialization in ACPI bits test needs to be removed
> since 'self.log' won't exist at that point in the flow. It already
> initialized 'self.logger' later in the setUp() method, so the __init__
> method was redundant.

Thanks for tackling it!

> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---

Reviewed-by: Thomas Huth <thuth@redhat.com>

... and queued it!
diff mbox series

Patch

diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index 50d232a7c6..50c401b8c3 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -33,12 +33,6 @@ 
 
 class QemuBaseTest(unittest.TestCase):
 
-    arch = None
-
-    workdir = None
-    log = None
-    logdir = None
-
     '''
     @params compressed: filename, Asset, or file-like object to uncompress
     @params format: optional compression format (gzip, lzma)
diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/test_acpi_bits.py
index 20da435687..8e0563a97b 100755
--- a/tests/functional/test_acpi_bits.py
+++ b/tests/functional/test_acpi_bits.py
@@ -119,7 +119,6 @@  def __init__(self, *args, **kwargs):
 
         self._debugcon_addr = '0x403'
         self._debugcon_log = 'debugcon-log.txt'
-        self.logger = self.log
 
     def _print_log(self, log):
         self.logger.info('\nlogs from biosbits follows:')