]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
functional: ensure log handlers are closed
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 15 Jul 2025 14:30:17 +0000 (15:30 +0100)
committerThomas Huth <thuth@redhat.com>
Mon, 21 Jul 2025 05:58:57 +0000 (07:58 +0200)
This avoids a resource leak warning from python when the
log handler is garbage collected.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250715143023.1851000-9-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/functional/qemu_test/testcase.py

index 2082c6fce43b0544d4e4258cd4155f555ed30cd4..71c7160adcf8dd53d7de88f6f003ad15ef9a052c 100644 (file)
@@ -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()