From 069a2ce8a75c9b59a4d08d6d2da3b36bfc5af3f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 15 Jul 2025 15:30:17 +0100 Subject: [PATCH] functional: ensure log handlers are closed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This avoids a resource leak warning from python when the log handler is garbage collected. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Message-ID: <20250715143023.1851000-9-berrange@redhat.com> Signed-off-by: Thomas Huth --- tests/functional/qemu_test/testcase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py index 2082c6fce43..71c7160adcf 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -232,6 +232,7 @@ class QemuBaseTest(unittest.TestCase): self.socketdir = None self.machinelog.removeHandler(self._log_fh) self.log.removeHandler(self._log_fh) + self._log_fh.close() def main(): path = os.path.basename(sys.argv[0])[:-3] @@ -399,4 +400,5 @@ class QemuSystemTest(QemuBaseTest): for vm in self._vms.values(): vm.shutdown() logging.getLogger('console').removeHandler(self._console_log_fh) + self._console_log_fh.close() super().tearDown() -- 2.47.2