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
2 changes: 0 additions & 2 deletions ci/cudf_pandas_scripts/pandas-tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ timeout 90m bash python/cudf/cudf/pandas/scripts/run-pandas-tests.sh \
--durations=10 \
--numprocesses 8 \
--tb=line \
--disable-warnings \
-m "not slow and not single_cpu and not db and not network" \
--max-worker-restart=3 \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cudf-pandas.xml" \
--dist worksteal \
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ extend-unsafe-fixes = [
[tool.ruff.lint.per-file-ignores]
# We use "== None" to demonstrate null handling in this notebook
"docs/cudf/source/cudf/missing-data.ipynb" = ["E711"]
# Lots of pytest implicitly injected attributes in conftest-patch.py
"python/cudf/cudf/pandas/scripts/conftest-patch.py" = ["F821"]
"python/cudf/cudf/pandas/scripts/*" = ["D"]
"python/cudf/cudf_pandas_tests/*" = ["D"]
"ci/*" = ["T201"]
Expand Down
28 changes: 28 additions & 0 deletions python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import abc
import contextlib
import copyreg
import datetime
import functools
Expand Down Expand Up @@ -1508,6 +1509,33 @@ def _register_index_accessor(name):
return pd.core.accessor._register_accessor(name, Index)


@contextlib.contextmanager
def null_assert_produces_warning(*args, **kwargs):
# We do not want pandas unit tests to fail because
# assert_produces_warning doesn't see a warning.
# No an explicit public API

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this comment mean?

@mroeschke mroeschke May 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose I was trying to convey "this is a proxy that doesn't faithfully fall back to pandas because we need it to be a no-op when we run pandas tests". I can tune this comment in a follow up PR or a next commit if needed.

try:
yield []
finally:
pass
Comment thread
mroeschke marked this conversation as resolved.


@register_proxy_func(pd._testing.assert_produces_warning)
def _register_assert_produces_warning(*args, **kwargs):
return null_assert_produces_warning(*args, **kwargs)


def null_raises_chained_assignment_error(*args, **kwargs):
# This assertion function also uses assert_produces_warning
# we want to ignore in pandas unit tests.
return null_assert_produces_warning(*args, **kwargs)


@register_proxy_func(pd._testing.raises_chained_assignment_error)
def _register_raises_chained_assignment_error(*args, **kwargs):
return null_raises_chained_assignment_error(*args, **kwargs)
Comment thread
coderabbitai[bot] marked this conversation as resolved.


@nvtx.annotate(
"CUDF_PANDAS_DATAFRAME_EVAL",
color=_CUDF_PANDAS_NVTX_COLORS["EXECUTE_SLOW"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import contextlib
import json
import os
import sys
import traceback
from collections import defaultdict
Expand All @@ -24,17 +22,8 @@ def wrapped(*args, **kwargs):
return wrapper


@contextlib.contextmanager
def null_assert_warnings(*args, **kwargs):
try:
yield []
finally:
pass


@pytest.fixture(scope="session", autouse=True)
def patch_testing_functions():
tm.assert_produces_warning = null_assert_warnings # noqa: F821
pytest.raises = replace_kwargs({"match": None})(pytest.raises)


Expand Down Expand Up @@ -7908,6 +7897,7 @@ def pytest_unconfigure(config):
}


@pytest.hookimpl(trylast=True)
def pytest_collection_modifyitems(session, config, items):
for item in items:
if (reason := NODEIDS_TO_SKIP.get(item.nodeid, None)) is not None:
Expand All @@ -7925,6 +7915,3 @@ def pytest_collection_modifyitems(session, config, items):
item.add_marker(pytest.mark.skip(reason=reason))
elif (reason := NODEIDS_THAT_FAIL.get(item.nodeid, None)) is not None:
item.add_marker(pytest.mark.xfail(reason=reason))


sys.path.append(os.path.dirname(__file__))
10 changes: 5 additions & 5 deletions python/cudf/cudf/pandas/scripts/run-pandas-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
# This script creates a `pandas-testing` directory if it doesn't exist
#
# If running locally, it's recommended to pass '-m "not slow and not single_cpu and not db"'

set -euo pipefail

Expand Down Expand Up @@ -91,15 +90,16 @@ EOF
done
fi

# append the contents of patch-confest.py to conftest.py
cat ../python/cudf/cudf/pandas/scripts/conftest-patch.py >> pandas-tests/conftest.py

# Run the tests
cd pandas-tests/


PANDAS_CI="1" python -m pytest -p cudf.pandas \
PANDAS_CI="1" python -m pytest \
-p cudf.pandas \
-p cudf.pandas.scripts.pandas-testing-plugin \
--import-mode=importlib \
-m "not slow and not single_cpu and not db and not network" \
--disable-warnings \
"$@"

mv ./*.json ..
Expand Down
Loading