Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions pandas/tests/io/pytables/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
)
from pandas.tests.io.pytables.common import (
_maybe_remove,
ensure_clean_store,
)

from pandas.io.pytables import TableIterator
Expand Down Expand Up @@ -70,14 +69,14 @@ def test_read_missing_key_opened_store(tmp_path, setup_path):
read_hdf(store, "k1")


def test_read_column(setup_path):
def test_read_column(temp_file):
df = DataFrame(
np.random.default_rng(2).standard_normal((10, 4)),
columns=Index(list("ABCD")),
index=date_range("2000-01-01", periods=10, freq="B"),
)

with ensure_clean_store(setup_path) as store:
with HDFStore(temp_file) as store:
_maybe_remove(store, "df")

# GH 17912
Expand Down Expand Up @@ -153,7 +152,7 @@ def test_read_column(setup_path):


def test_pytables_native_read(datapath):
with ensure_clean_store(
with HDFStore(
datapath("io", "data", "legacy_hdf/pytables_native.h5"), mode="r"
) as store:
d2 = store["detector/readout"]
Expand All @@ -162,7 +161,7 @@ def test_pytables_native_read(datapath):

@pytest.mark.skipif(is_platform_windows(), reason="native2 read fails oddly on windows")
def test_pytables_native2_read(datapath):
with ensure_clean_store(
with HDFStore(
datapath("io", "data", "legacy_hdf", "pytables_native2.h5"), mode="r"
) as store:
str(store)
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/io/pytables/test_retain_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pandas import (
DataFrame,
DatetimeIndex,
HDFStore,
Series,
_testing as tm,
date_range,
Expand All @@ -11,18 +12,17 @@
)
from pandas.tests.io.pytables.common import (
_maybe_remove,
ensure_clean_store,
)

pytestmark = pytest.mark.single_cpu


def test_retain_index_attributes(setup_path, unit):
def test_retain_index_attributes(temp_file, unit):
# GH 3499, losing frequency info on index recreation
dti = date_range("2000-1-1", periods=3, freq="h", unit=unit)
df = DataFrame({"A": Series(range(3), index=dti)})

with ensure_clean_store(setup_path) as store:
with HDFStore(temp_file) as store:
_maybe_remove(store, "data")
store.put("data", df, format="table")

Expand Down
Loading