From 9bf5c84c418f211982b43e44563b6915b6c3b830 Mon Sep 17 00:00:00 2001 From: cis-kuldeep Date: Fri, 9 Jul 2021 15:49:11 +0530 Subject: [PATCH] fixed unclosed file error --- src/tests/test_process.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/test_process.py b/src/tests/test_process.py index 76be96a0..7a7549ef 100644 --- a/src/tests/test_process.py +++ b/src/tests/test_process.py @@ -84,7 +84,8 @@ class TestProcessProto(unittest.TestCase): def _get_readline(cls, pfile): pfile = os.path.join(cls.home, pfile) try: - return open(pfile, 'rb').readline().strip() + with open(pfile, 'rb') as p: + return p.readline().strip() except (OSError, IOError): pass