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
8 changes: 4 additions & 4 deletions python/cudf/cudf/tests/input_output/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from cudf.testing._utils import assert_exceptions_equal


@pytest.fixture
@pytest.fixture(scope="module")
def pd_mixed_dataframe():
return pd.DataFrame(
{
Expand All @@ -35,12 +35,12 @@ def pd_mixed_dataframe():
)


@pytest.fixture
@pytest.fixture(scope="module")
def cudf_mixed_dataframe(pd_mixed_dataframe):
return cudf.from_pandas(pd_mixed_dataframe)


@pytest.fixture
@pytest.fixture(scope="module")
def gdf_np_dtypes():
gdf_dtypes = [
"float",
Expand Down Expand Up @@ -80,7 +80,7 @@ def gdf_np_dtypes():
return dict(zip(gdf_dtypes, np_dtypes, strict=True))


@pytest.fixture
@pytest.fixture(scope="module")
def numeric_extremes_dataframe(gdf_np_dtypes):
data = {}
for typ, np_type in gdf_np_dtypes.items():
Expand Down
8 changes: 5 additions & 3 deletions python/cudf/cudf/tests/input_output/test_dlpack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import itertools
Expand Down Expand Up @@ -30,8 +30,9 @@ def data_size_expectation_builder(data, nan_null_param=False):
return does_not_raise()


@pytest.fixture(params=params_1d)
@pytest.fixture(scope="module", params=params_1d)
def data_1d(request):
# DLPack conversion tests only read the generated host array.
nelems = request.param[0]
dtype = request.param[1]
nulls = request.param[2]
Expand All @@ -43,8 +44,9 @@ def data_1d(request):
return a


@pytest.fixture(params=params_2d)
@pytest.fixture(scope="module", params=params_2d)
def data_2d(request):
# DLPack conversion tests only read the generated host array.
ncols = request.param[0]
nrows = request.param[1]
dtype = request.param[2]
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/tests/input_output/test_feather.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
from cudf.testing._utils import NUMERIC_TYPES


@pytest.fixture(params=[0, 10])
@pytest.fixture(scope="module", params=[0, 10])
def pdf(request):
# Feather reader and writer tests only read this source dataframe.
rng = np.random.default_rng(seed=0)
types = [*NUMERIC_TYPES, "bool"]
nrows = request.param
Expand Down
7 changes: 4 additions & 3 deletions python/cudf/cudf/tests/input_output/test_hdf5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2018-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import os
Expand All @@ -15,8 +15,9 @@
pytest.importorskip("tables")


@pytest.fixture(params=[0, 10])
@pytest.fixture(scope="module", params=[0, 10])
def pdf(request):
# Reader and writer tests only read this source dataframe.
types = set([*NUMERIC_TYPES, "datetime64[ns]", "bool"]) - set(
UNSIGNED_TYPES
)
Expand Down Expand Up @@ -44,7 +45,7 @@ def pdf(request):
return (test_pdf, nrows)


@pytest.fixture
@pytest.fixture(scope="module")
def gdf(pdf):
pdf, nrows = pdf
return (cudf.DataFrame(pdf), nrows)
Expand Down
8 changes: 5 additions & 3 deletions python/cudf/cudf/tests/input_output/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ def lines(request):
return request.param


@pytest.fixture(params=[0, 10])
@pytest.fixture(scope="module", params=[0, 10])
def pdf(request):
# JSON tests share this immutable source dataframe.
rng = np.random.default_rng(seed=0)
types = NUMERIC_TYPES + DATETIME_TYPES + ["bool"]
nrows = request.param
Expand All @@ -50,12 +51,12 @@ def pdf(request):
return test_pdf


@pytest.fixture
@pytest.fixture(scope="module")
def gdf(pdf):
return cudf.DataFrame(pdf)


@pytest.fixture(params=[0, 10])
@pytest.fixture(scope="module", params=[0, 10])
def gdf_writer_types(request):
# datetime64[us], datetime64[ns] are unsupported due to a bug in parser
types = [
Expand Down Expand Up @@ -175,6 +176,7 @@ def test_json_writer(tmp_path, pdf, gdf):

def test_cudf_json_writer(pdf, lines):
# removing datetime column because pandas doesn't support it
pdf = pdf.copy()
for col_name in pdf.columns:
if "datetime" in col_name:
pdf.drop(col_name, axis=1, inplace=True)
Expand Down
44 changes: 24 additions & 20 deletions python/cudf/cudf/tests/input_output/test_orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ def test_pyspark_struct(datadir):
assert_eq(pdf, gdf)


@pytest.fixture
@pytest.fixture(scope="module")
def map_buff():
size = 100
rd = random.Random(1)
Expand Down Expand Up @@ -1349,21 +1349,19 @@ def dec(num):
return decimal.Decimal(str(num))


@pytest.mark.parametrize(
"data",
[
# basic + nested strings
{
def _make_orc_list_data(case):
if case == "nested":
return {
"lls": [[["a"], ["bb"]] * 5 for i in range(12345)],
"lls2": [[["ccc", "dddd"]] * 6 for i in range(12345)],
"ls_dict": [["X"] * 7 for i in range(12345)],
"ls_direct": [[str(i)] * 9 for i in range(12345)],
"li": [[i] * 11 for i in range(12345)],
"lf": [[i * 0.5] * 13 for i in range(12345)],
"ld": [[dec(i / 2)] * 15 for i in range(12345)],
},
# with nulls
{
}
elif case == "nulls":
return {
"ls": [
[str(i) if i % 5 else None, str(2 * i)] if i % 2 else None
for i in range(12345)
Expand All @@ -1373,9 +1371,9 @@ def dec(num):
[dec(i), dec(i / 2) if i % 7 else None] if i % 5 else None
for i in range(12345)
],
},
# with empty elements
{
}
elif case == "empty":
return {
"ls": [
[str(i), str(2 * i)] if i % 2 else [] for i in range(12345)
],
Expand All @@ -1391,18 +1389,24 @@ def dec(num):
"ld": [
[dec(i), dec(i / 2)] if i % 5 else [] for i in range(12345)
],
},
# variable list lengths
{
}
elif case == "variable-lengths":
return {
"ls": [[str(i)] * i for i in range(123)],
"li": [[i, i * i] * i for i in range(123)],
"ld": [[dec(i), dec(i / 2)] * i for i in range(123)],
},
# many child elements (more that max_stripe_rows)
{"li": [[i] * 1100 for i in range(11000)]},
],
}
elif case == "many-child-elements":
# More child elements than max_stripe_rows.
return {"li": [[i] * 1100 for i in range(11000)]}


@pytest.mark.parametrize(
"case",
["nested", "nulls", "empty", "variable-lengths", "many-child-elements"],
)
def test_orc_writer_lists(data):
def test_orc_writer_lists(case):
data = _make_orc_list_data(case)
buffer = BytesIO()
cudf.DataFrame(data).to_orc(
buffer, stripe_size_rows=2048, row_index_stride=512
Expand Down
13 changes: 7 additions & 6 deletions python/cudf/cudf/tests/input_output/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def datadir(datadir):
return datadir / "parquet"


@pytest.fixture
@pytest.fixture(scope="module")
def simple_pdf():
nrows = 10
rng = np.random.default_rng(seed=0)
Expand Down Expand Up @@ -90,7 +90,7 @@ def simple_pdf():
return test_pdf


@pytest.fixture
@pytest.fixture(scope="module")
def simple_gdf(simple_pdf):
return cudf.DataFrame(simple_pdf)

Expand Down Expand Up @@ -176,22 +176,22 @@ def build_pdf(num_columns, day_resolution_timestamps):
return test_pdf


@pytest.fixture(params=[0, 10])
@pytest.fixture(scope="module", params=[0, 10])
def pdf(request):
return build_pdf(request.param, False)


@pytest.fixture(params=[0, 10])
@pytest.fixture(scope="module", params=[0, 10])
def pdf_day_timestamps(request):
return build_pdf(request.param, True)


@pytest.fixture
@pytest.fixture(scope="module")
def gdf(pdf):
return cudf.DataFrame(pdf)


@pytest.fixture
@pytest.fixture(scope="module")
def gdf_day_timestamps(pdf_day_timestamps):
return cudf.DataFrame(pdf_day_timestamps)

Expand Down Expand Up @@ -2981,6 +2981,7 @@ def test_parquet_writer_column_validation():


def test_parquet_writer_nulls_pandas_read(tmp_path, pdf):
pdf = pdf.copy()
if "col_bool" in pdf.columns:
pdf.drop(columns="col_bool", inplace=True)
if "col_category" in pdf.columns:
Expand Down
6 changes: 3 additions & 3 deletions python/cudf/cudf/tests/input_output/test_s3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import subprocess
Expand Down Expand Up @@ -84,7 +84,7 @@ def kvikio_remote_io(request):
yield request.param


@pytest.fixture
@pytest.fixture(scope="module")
def pdf():
return pd.DataFrame(
{
Expand All @@ -97,7 +97,7 @@ def pdf():
)


@pytest.fixture
@pytest.fixture(scope="module")
def pdf_ext():
size = 10
return pd.DataFrame(
Expand Down
Loading