diff --git a/qubes/tests/__init__.py b/qubes/tests/__init__.py index 534bd31bb..b9ffae7cd 100644 --- a/qubes/tests/__init__.py +++ b/qubes/tests/__init__.py @@ -532,6 +532,10 @@ def kernel_validator_patched(obj, key, value): ) self.skip_kernel_validation_patch.start() + def tearDown(self): + self.skip_kernel_validation_patch.stop() + super().tearDown() + def cleanup_gc(self): # remove cached references to Qubes() object qubes.api.internal.SystemInfoCache.cache_for_app = None @@ -953,6 +957,12 @@ def cleanup_app(self): obj_type = type(getattr(self, attr)) if obj_type.__module__.startswith("qubes"): delattr(self, attr) + elif issubclass(obj_type, list) and any( + type(obj).__module__.startswith("qubes") + for obj in getattr(self, attr) + ): + # remove also list of qubes objects + delattr(self, attr) # then trigger garbage collector to really destroy those objects gc.collect() diff --git a/qubes/tests/rpc_import.py b/qubes/tests/rpc_import.py index ad9018b7c..145e212cc 100644 --- a/qubes/tests/rpc_import.py +++ b/qubes/tests/rpc_import.py @@ -69,6 +69,7 @@ class TestRpcImport(qubes.tests.QubesTestCase): ) def setUp(self): + super().setUp() self.tmpdir = tempfile.mkdtemp() self.addCleanup(shutil.rmtree, self.tmpdir) with open(