From: Vladimir Sementsov-Ogievskiy Date: Sat, 25 Oct 2025 16:58:03 +0000 (+0300) Subject: tests/functional/.../testcase.py: better socketdir cleanup X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee7c35e77f214c39340679ffb335f25527d134d3;p=thirdparty%2Fqemu.git tests/functional/.../testcase.py: better socketdir cleanup TemporaryDirectory prefer explicit call to .cleanup() (or use context manager). Otherwise it may produce a warning like: /usr/lib/python3.10/tempfile.py:1008: \ ResourceWarning: Implicitly cleaning up \ Currently, the only test using socket_dir() is tests/functional/x86_64/test_vfio_user_client.py, and it does print this warning, at least with python 3.10.12. With this commit, the warning disappears. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Thomas Huth Message-ID: <20251025165809.930670-2-vsementsov@yandex-team.ru> Signed-off-by: Thomas Huth --- diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py index 2c0abde395..a122acb560 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -233,7 +233,7 @@ class QemuBaseTest(unittest.TestCase): if "QEMU_TEST_KEEP_SCRATCH" not in os.environ: shutil.rmtree(self.workdir) if self.socketdir is not None: - shutil.rmtree(self.socketdir.name) + self.socketdir.cleanup() self.socketdir = None self.machinelog.removeHandler(self._log_fh) self.log.removeHandler(self._log_fh)