Skip to content

TST: Fix HDFStore leak in tests/io/pytables/test_store.py #32722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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