Skip to content

Commit

Permalink
Fix HDFStore leak in tests/io/pytables/test_store.py (#32722)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberthdevries authored Mar 16, 2020
1 parent ad9db99 commit 23f8763
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pandas/tests/io/pytables/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,14 +1217,14 @@ def test_read_missing_key_opened_store(self, setup_path):
df = pd.DataFrame({"a": range(2), "b": range(2)})
df.to_hdf(path, "k1")

store = pd.HDFStore(path, "r")
with pd.HDFStore(path, "r") as store:

with pytest.raises(KeyError, match="'No object named k2 in the file'"):
pd.read_hdf(store, "k2")
with pytest.raises(KeyError, match="'No object named k2 in the file'"):
pd.read_hdf(store, "k2")

# Test that the file is still open after a KeyError and that we can
# still read from it.
pd.read_hdf(store, "k1")
# Test that the file is still open after a KeyError and that we can
# still read from it.
pd.read_hdf(store, "k1")

def test_append_frame_column_oriented(self, setup_path):
with ensure_clean_store(setup_path) as store:
Expand Down

0 comments on commit 23f8763

Please sign in to comment.