From 2da2560c2b2adff827344d1db198acc1ecb097ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 30 May 2026 23:21:13 +0200 Subject: [PATCH 1/2] tests: add missing test cleanup skip_kernel_validation_patch was not stopped, and keeps reference to some objects. This also requires setUp() being called consistently - fix this one in rpc_import tests. --- qubes/tests/__init__.py | 4 ++++ qubes/tests/rpc_import.py | 1 + 2 files changed, 5 insertions(+) diff --git a/qubes/tests/__init__.py b/qubes/tests/__init__.py index 534bd31bb..4c1485c7c 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 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( From 50f555b20409894cba1b962d9be019d305f7a00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 6 Jun 2026 15:23:52 +0200 Subject: [PATCH 2/2] tests: drop references to qubes objects via lists too There is a code that drops references to Qubes* objects saved directly in test instance attributes already. But 274bb390 "Set deferred netvm for paused clients on shutdown" introduced also a list of such objects, which weren't cleaned up. Fix it by considering lists too - if first element is a qubes object, remove the whole list. Fixes: 274bb390 "Set deferred netvm for paused clients on shutdown" --- qubes/tests/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qubes/tests/__init__.py b/qubes/tests/__init__.py index 4c1485c7c..b9ffae7cd 100644 --- a/qubes/tests/__init__.py +++ b/qubes/tests/__init__.py @@ -957,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()