From d0d86db5c98ad68473ca9b7e201fd449f1e4ed1b Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 19 Nov 2025 09:26:29 +0100 Subject: [PATCH] tests/functional/x86_64/test_memlock: Silence pylint warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Pylint complains about a missing "encoding" parameter for the open() function here, and about a missing return statement in the "except" block (which cannot happen since skipTest() never returns). Rework the code a little bit to silence the warnings. Reviewed-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth Message-ID: <20251119082636.43286-9-thuth@redhat.com> --- tests/functional/x86_64/test_memlock.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/functional/x86_64/test_memlock.py b/tests/functional/x86_64/test_memlock.py index 81bce80b0c..f970a2c309 100755 --- a/tests/functional/x86_64/test_memlock.py +++ b/tests/functional/x86_64/test_memlock.py @@ -69,11 +69,13 @@ class MemlockTest(QemuSystemTest): return result def _get_raw_process_status(self, pid: int) -> str: + status = None try: - with open(f'/proc/{pid}/status', 'r') as f: - return f.read() + with open(f'/proc/{pid}/status', 'r', encoding="ascii") as f: + status = f.read() except FileNotFoundError: self.skipTest("Can't open status file of the process") + return status if __name__ == '__main__': -- 2.47.3