Skip to content

Commit fa43105

Browse files
pb8ozulinx86
authored andcommitted
test: don't use destructors
These destructors get called when the instance gets out of lexical scope, which makes some issues tricky to debug. We will cleanup at test teardown instead, and anyway everything gets deleted after the container exits. Signed-off-by: Pablo Barbáchano <pablob@amazon.com>
1 parent 7649350 commit fa43105

File tree

3 files changed

+1
-8
lines changed

3 files changed

+1
-8
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def kill(self):
314314
"""Clean up all built VMs"""
315315
for vm in self.vms:
316316
vm.kill()
317+
vm.jailer.cleanup()
317318
shutil.rmtree(self.tmp_path)
318319

319320
uvm_factory = MicroVMFactory(fc_tmp_path, bin_cloner_path)

tests/framework/jailer.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ def __init__(
7979
self.ramfs_subdir_name = "ramfs"
8080
self._ramfs_path = None
8181

82-
def __del__(self):
83-
"""Cleanup this jailer context."""
84-
self.cleanup()
85-
8682
# Disabling 'too-many-branches' warning for this function as it needs to
8783
# check every argument, so the number of branches will increase
8884
# with every new argument.

tests/framework/microvm.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,10 +1023,6 @@ def monitor_fd(microvm, path):
10231023
self.logging_thread.daemon = True
10241024
self.logging_thread.start()
10251025

1026-
def __del__(self):
1027-
"""Teardown the object."""
1028-
self.kill()
1029-
10301026

10311027
class Serial:
10321028
"""Class for serial console communication with a Microvm."""

0 commit comments

Comments
 (0)