Skip to contentSkip to conversation

Acceptance Tests: add standard clean up at test tearDown()

PATCH In review Willian Rampazzo 2 participants 2 messages Sep 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Acceptance Tests: add standard clean up at test tearDown()

From: Cleber Rosa <[email protected]>

The avocado.Test class, used as the basis of the avocado_qemu.Test class, performs a clean of temporary directories up as part of its own tearDown() implementation.

But the avocado_qemu.Test class is currently missing the same clean up, as it implemented its own tearDown() method without resorting to the upper class behavior.

This brings avocado_qemu.Test behavior in sync with the standard avocado.Test behavior and prevents temporary directories from cluttering the test results directory (unless instructed to do so with Avocado's "--keep-tmp" option).

[willianr: respin to new Python super format]

---
v2
- adjust super call to conform with PEP3135

---
 tests/acceptance/avocado_qemu/__init__.py | 1 +
 1 file changed, 1 insertion(+)
tests/acceptance/avocado_qemu/__init__.py +1 -0
index 2c4fef3e14..d9e1b32aa1 100644
@@ -276,6 +276,7 @@ def tearDown(self):
         for vm in self._vms.values():
             vm.shutdown()
         self._sd = None
+        super().tearDown()
 
     def fetch_asset(self, name,
                     asset_hash=None, algorithm=None,
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 20 lines · Willian Rampazzo

From: Cleber Rosa <[email protected]>

The avocado.Test class, used as the basis of the avocado_qemu.Test class, performs a clean of temporary directories up as part of its own tearDown() implementation.

But the avocado_qemu.Test class is currently missing the same clean up, as it implemented its own tearDown() method without resorting to the upper class behavior.

This brings avocado_qemu.Test behavior in sync with the standard avocado.Test behavior and prevents temporary directories from cluttering the test results directory (unless instructed to do so with Avocado's "--keep-tmp" option).

[willianr: respin to new Python super format]
Quoted 6 lines

---
v2
- adjust super call to conform with PEP3135

---
  tests/acceptance/avocado_qemu/__init__.py | 1 +
  1 file changed, 1 insertion(+)
Quoted 13 lines
tests/acceptance/avocado_qemu/__init__.py +1 -0
index 2c4fef3e14..d9e1b32aa1 100644
@@ -276,6 +276,7 @@ def tearDown(self):
          for vm in self._vms.values():
              vm.shutdown()
          self._sd = None
+        super().tearDown()
 
      def fetch_asset(self, name,
                      asset_hash=None, algorithm=None,