From c90bbd47c115b726bb60e77f68af3483b7381be3 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola <g.rodola@gmail.com> Date: Wed, 4 Oct 2023 13:50:42 +0200 Subject: [PATCH] small refact --- psutil/tests/test_misc.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py index 64b998da3..b3515de31 100755 --- a/psutil/tests/test_misc.py +++ b/psutil/tests/test_misc.py @@ -843,8 +843,7 @@ def assert_stdout(exe, *args, **kwargs): @staticmethod def assert_syntax(exe): exe = os.path.join(SCRIPTS_DIR, exe) - f = open(exe, encoding="utf8") if PY3 else open(exe) - with f: + with open(exe, encoding="utf8") if PY3 else open(exe) as f: src = f.read() ast.parse(src)