From fa91d0627d4886448d0c6bd6746dbb904cc9bd58 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 2 Nov 2010 18:16:30 +0100 Subject: [PATCH] fix test runner warning in Python 3.2 debug builds --- runtests.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/runtests.py b/runtests.py index 1063d5fb..bb4937c4 100644 --- a/runtests.py +++ b/runtests.py @@ -763,10 +763,14 @@ class FileListExcluder: def __init__(self, list_file): self.excludes = {} - for line in open(list_file).readlines(): - line = line.strip() - if line and line[0] != '#': - self.excludes[line.split()[0]] = True + f = open(list_file) + try: + for line in f.readlines(): + line = line.strip() + if line and line[0] != '#': + self.excludes[line.split()[0]] = True + finally: + f.close() def __call__(self, testname): return testname in self.excludes or testname.split('.')[-1] in self.excludes -- 2.26.2