Skip to content

Commit

Permalink
Fix ResourceWarning seen in Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmatthews committed Sep 24, 2014
1 parent 1a4736b commit 6fc7daf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions COT/tests/ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ def check_diff(self, expected, file1=None, file2=None):
file1 = self.input_ovf
if file2 is None:
file2 = self.temp_file
diff = unified_diff(open(file1).readlines(), open(file2).readlines(),
fromfile=file1, tofile=file2,
n=1) # number of context lines
with open(file1) as f1:
with open(file2) as f2:
diff = unified_diff(f1.readlines(), f2.readlines(),
fromfile=file1, tofile=file2,
n=1) # number of context lines
# Strip line numbers and file names from the diff
# to keep the UT more maintainable
clean_diff = ""
Expand Down

0 comments on commit 6fc7daf

Please sign in to comment.