diff --git a/ci/cudf_pandas_scripts/third-party-integration/run-library-tests.sh b/ci/cudf_pandas_scripts/third-party-integration/run-library-tests.sh index ce3291b864a..ed564a39745 100755 --- a/ci/cudf_pandas_scripts/third-party-integration/run-library-tests.sh +++ b/ci/cudf_pandas_scripts/third-party-integration/run-library-tests.sh @@ -13,6 +13,7 @@ runtest() { local lib=$1 local mode=$2 + echo "Running tests for $lib in $mode mode" local plugin="" if [ "$mode" = "cudf" ]; then plugin="-p cudf.pandas" diff --git a/ci/cudf_pandas_scripts/third-party-integration/test.sh b/ci/cudf_pandas_scripts/third-party-integration/test.sh index c6f5844427d..cf0a16fb3cb 100755 --- a/ci/cudf_pandas_scripts/third-party-integration/test.sh +++ b/ci/cudf_pandas_scripts/third-party-integration/test.sh @@ -27,7 +27,7 @@ main() { lib=$(echo "$lib" | tr -d '""') echo "Running tests for library $lib" - CUDA_MAJOR=$(if [ "$lib" = "tensorflow" ]; then echo "11"; else echo "12"; fi) + CUDA_VERSION=$(if [ "$lib" = "tensorflow" ]; then echo "11.8"; else echo "${RAPIDS_CUDA_VERSION%.*}"; fi) . /opt/conda/etc/profile.d/conda.sh @@ -36,7 +36,7 @@ main() { --config "$dependencies_yaml" \ --output conda \ --file-key "test_${lib}" \ - --matrix "cuda=${CUDA_MAJOR};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml + --matrix "cuda=${CUDA_VERSION};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml rapids-mamba-retry env create --yes -f env.yaml -n test diff --git a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/conftest.py b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/conftest.py index 33b6ffdbd5c..553d9c4459e 100644 --- a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/conftest.py +++ b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/conftest.py @@ -1,7 +1,8 @@ -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, NVIDIA CORPORATION. from __future__ import annotations +import glob import os import pickle from typing import TYPE_CHECKING, BinaryIO @@ -75,23 +76,40 @@ def swap_xfail(item: _pytest.nodes.Item, name: str): swap_xfail(item, "xfail_compare") +def get_full_nodeid(pyfuncitem): + # Get the full path to the test file + filepath = pyfuncitem.path + # Get the test name and any parameters + test_name = "::".join(pyfuncitem.nodeid.split("::")[1:]) + # Combine the full file path with the test name + full_nodeid = f"{filepath}::{test_name}" + return full_nodeid + + +def read_all_results(pattern): + results = {} + for filepath in glob.glob(pattern): + with open(filepath, "rb") as f: + results.update(dict(read_results(f))) + return results + + def pytest_configure(config: _pytest.config.Config): gold_basename = "results-gold" cudf_basename = "results-cudf-pandas" test_folder = os.path.join(os.path.dirname(__file__)) if config.getoption("--compare"): - # Everyone reads everything - gold_path = os.path.join(test_folder, f"{gold_basename}.pickle") - cudf_path = os.path.join(test_folder, f"{cudf_basename}.pickle") + gold_path = os.path.join(test_folder, f"{gold_basename}*.pickle") + cudf_path = os.path.join(test_folder, f"{cudf_basename}*.pickle") with disable_module_accelerator(): - with open(gold_path, "rb") as f: - gold_results = dict(read_results(f)) - with open(cudf_path, "rb") as f: - cudf_results = dict(read_results(f)) + gold_results = read_all_results(gold_path) + cudf_results = read_all_results(cudf_path) config.stash[results] = (gold_results, cudf_results) else: - if "cudf.pandas" in config.option.plugins: + if any( + plugin.strip() == "cudf.pandas" for plugin in config.option.plugins + ): basename = cudf_basename else: basename = gold_basename @@ -112,7 +130,7 @@ def pytest_configure(config: _pytest.config.Config): def pytest_pyfunc_call(pyfuncitem: _pytest.python.Function): if pyfuncitem.config.getoption("--compare"): gold_results, cudf_results = pyfuncitem.config.stash[results] - key = pyfuncitem.nodeid + key = get_full_nodeid(pyfuncitem) try: gold = gold_results[key] except KeyError: @@ -140,7 +158,7 @@ def pytest_pyfunc_call(pyfuncitem: _pytest.python.Function): # Tuple-based key-value pairs, key is the node-id try: pickle.dump( - (pyfuncitem.nodeid, result), + (get_full_nodeid(pyfuncitem), result), pyfuncitem.config.stash[file_handle_key], ) except pickle.PicklingError: