Skip to content

Commit 755c413

Browse files
authored
tests: fix unclosed files in testing/test_readline.py (#32)
1 parent c13f15f commit 755c413

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

testing/test_readline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def test_write_history_file(readline_wrapper, tmp_path):
7878

7979
readline_wrapper.write_history_file(str(histfile))
8080

81-
assert open(str(histfile), "r").readlines() == ["foo\n", "bar\n"]
81+
with open(str(histfile), "r") as f:
82+
assert f.readlines() == ["foo\n", "bar\n"]
8283

8384

8485
def test_write_history_file_with_exception(readline_wrapper, tmp_path):
@@ -102,4 +103,5 @@ def replace(cls, *args):
102103
with pytest.raises(BadEntryException):
103104
readline_wrapper.write_history_file(str(histfile))
104105

105-
assert open(str(histfile), "r").readlines() == ["foo\n", "bar\n"]
106+
with open(str(histfile), "r") as f:
107+
assert f.readlines() == ["foo\n", "bar\n"]

0 commit comments

Comments
 (0)