diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-27 10:24:03 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-27 10:24:03 +0100 |
commit | e3fc01dad3443cb16f21eebcca44abd14a49a4f6 (patch) | |
tree | 67bba9cf8cb81741e82b85ccf514a12db2e78527 | |
parent | ff197c6bba504c583dbd53d2870afa8f2bd3864e (diff) | |
download | rspamd-e3fc01dad3443cb16f21eebcca44abd14a49a4f6.tar.gz rspamd-e3fc01dad3443cb16f21eebcca44abd14a49a4f6.zip |
[Minor] Close file once it is not needed
-rw-r--r-- | test/functional/lib/rspamd.py | 8 |
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): |