From e79a0e21e92c883a52f4b27b62ed9c93676cc39d Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Thu, 12 Aug 2021 17:34:15 +0530 Subject: [PATCH] Updated _get_readline function file open by with block Reverted skip_python3 function remove change --- 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 d976aa18..7f7691d1 100644 --- a/src/tests/test_process.py +++ b/src/tests/test_process.py @@ -87,7 +87,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