From e3fc01dad3443cb16f21eebcca44abd14a49a4f6 Mon Sep 17 00:00:00 2001 From: Mikhail Galanin Date: Thu, 27 Sep 2018 10:24:03 +0100 Subject: [Minor] Close file once it is not needed --- test/functional/lib/rspamd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index eeb5f2799..313e8393e 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -116,10 +116,10 @@ def path_splitter(path): def read_log_from_position(filename, offset): offset = long(offset) - f = open(filename, 'rb') - f.seek(offset) - goo = f.read() - size = len(goo) + with open(filename, 'rb') as f: + f.seek(offset) + goo = f.read() + size = len(goo) return [goo, size+offset] def rspamc(addr, port, filename): -- cgit v1.2.3