From 515f77f0faefd36683e6039e618b10d88b541ed5 Mon Sep 17 00:00:00 2001 From: Juhani Numminen Date: Wed, 7 Jul 2021 16:59:56 +0300 Subject: [PATCH] Fix files left open after reading --- tests/lib/pysol_tests/test_import_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/pysol_tests/test_import_file.py b/tests/lib/pysol_tests/test_import_file.py index b46eb9e5..a4511676 100644 --- a/tests/lib/pysol_tests/test_import_file.py +++ b/tests/lib/pysol_tests/test_import_file.py @@ -43,8 +43,8 @@ class ImportFileTests(unittest.TestCase): """docstring for _calc_hint""" s_game = Mock_S_Game() h = FreeCellSolver_Hint(s_game, None) - fh = open(fn, 'r+b') - h.importFileHelper(fh, s_game) + with open(fn, 'r+b') as fh: + h.importFileHelper(fh, s_game) return h def _successful_import(self, fn, want_s, blurb):