From: Thomas Huth Date: Wed, 19 Nov 2025 08:26:29 +0000 (+0100) Subject: tests/functional/x86_64/test_memlock: Silence pylint warnings X-Git-Tag: v10.2.0-rc2~14^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0d86db5c98ad68473ca9b7e201fd449f1e4ed1b;p=thirdparty%2Fqemu.git tests/functional/x86_64/test_memlock: Silence pylint warnings 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> --- 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__':