aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-09-27 10:24:03 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-09-27 10:24:03 +0100
commite3fc01dad3443cb16f21eebcca44abd14a49a4f6 (patch)
tree67bba9cf8cb81741e82b85ccf514a12db2e78527
parentff197c6bba504c583dbd53d2870afa8f2bd3864e (diff)
downloadrspamd-e3fc01dad3443cb16f21eebcca44abd14a49a4f6.tar.gz
rspamd-e3fc01dad3443cb16f21eebcca44abd14a49a4f6.zip
[Minor] Close file once it is not needed
-rw-r--r--test/functional/lib/rspamd.py8
1 files changed, 4 insertions, 4 deletions
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):