diff options
Diffstat (limited to 'src/test_strings.py')
-rw-r--r-- | src/test_strings.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test_strings.py b/src/test_strings.py index e9f0abf..a8a5000 100644 --- a/src/test_strings.py +++ b/src/test_strings.py @@ -98,7 +98,8 @@ class Checker(object): for fname in filenames: fpath = os.path.join(dirpath, fname) if self.search_this(fpath) and not self.remove_this(fname, fpath): - body = open(fpath, 'r').read() + with open(fpath, 'r') as f: + body = f.read() for expr in self.expressions: if not expr.search(body): msg = '%s: missing %s' % (fpath, repr(expr.pattern)) |