Skip to content

Commit

Permalink
tests: fix unclosed files in testing/test_readline.py (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed authored Dec 17, 2020
1 parent c13f15f commit 755c413
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions testing/test_readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def test_write_history_file(readline_wrapper, tmp_path):

readline_wrapper.write_history_file(str(histfile))

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


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

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

0 comments on commit 755c413

Please sign in to comment.