Mercurial > public > mercurial-scm > hg
diff tests/run-tests.py @ 13400:14f3795a5ed7
explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 15:23:01 +0100 |
parents | 31fdb04cb5e8 |
children | b3330b8e1e6f |
line wrap: on
line diff
--- a/tests/run-tests.py Fri Feb 11 22:24:10 2011 +0800 +++ b/tests/run-tests.py Fri Dec 24 15:23:01 2010 +0100 @@ -231,6 +231,8 @@ if line and not line.startswith('#'): blacklist[line] = filename + f.close() + options.blacklist = blacklist return (options, args) @@ -491,6 +493,8 @@ # non-command/result - queue up for merged output after.setdefault(pos, []).append(l) + t.close() + script.append('echo %s %s $?\n' % (salt, n + 1)) fd, name = tempfile.mkstemp(suffix='hg-tst') @@ -927,7 +931,9 @@ continue if options.keywords: - t = open(test).read().lower() + test.lower() + fp = open(test) + t = fp.read().lower() + test.lower() + fp.close() for k in options.keywords.lower().split(): if k in t: break