From 81c383c925693ef48e811f746b2d831544e92e1b Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Mon, 3 Feb 2025 17:44:10 -0800 Subject: [PATCH] Add script to run pylibcudf tests (#17882) This is a small change adding a script to run pylibcudf tests, like we have for other Python libraries in this repository. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Matthew Murray (https://github.com/Matt711) - Vyas Ramasubramani (https://github.com/vyasr) URL: https://github.com/rapidsai/cudf/pull/17882 --- ci/run_pylibcudf_pytests.sh | 11 +++++++++++ ci/test_python_common.sh | 1 + ci/test_python_cudf.sh | 14 ++++++++------ python/pylibcudf/.coveragerc | 3 +++ 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 ci/run_pylibcudf_pytests.sh create mode 100644 python/pylibcudf/.coveragerc diff --git a/ci/run_pylibcudf_pytests.sh b/ci/run_pylibcudf_pytests.sh new file mode 100755 index 00000000000..2341801e4d0 --- /dev/null +++ b/ci/run_pylibcudf_pytests.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright (c) 2025, NVIDIA CORPORATION. + +set -euo pipefail + +# It is essential to cd into python/pylibcudf/pylibcudf as `pytest-xdist` + `coverage` seem to work only at this directory level. + +# Support invoking run_cudf_pytests.sh outside the script directory +cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/pylibcudf/pylibcudf/ + +pytest --cache-clear --ignore="benchmarks" "$@" tests diff --git a/ci/test_python_common.sh b/ci/test_python_common.sh index c6c6a3957b9..65d3125552a 100755 --- a/ci/test_python_common.sh +++ b/ci/test_python_common.sh @@ -41,4 +41,5 @@ rapids-mamba-retry install \ --channel "${CPP_CHANNEL}" \ --channel "${PYTHON_CHANNEL}" \ "cudf=${RAPIDS_VERSION}" \ + "pylibcudf=${RAPIDS_VERSION}" \ "libcudf=${RAPIDS_VERSION}" diff --git a/ci/test_python_cudf.sh b/ci/test_python_cudf.sh index 9528549a562..3312c2b82b7 100755 --- a/ci/test_python_cudf.sh +++ b/ci/test_python_cudf.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2022-2024, NVIDIA CORPORATION. +# Copyright (c) 2022-2025, NVIDIA CORPORATION. # Support invoking test_python_cudf.sh outside the script directory cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../; @@ -15,12 +15,14 @@ trap "EXITCODE=1" ERR set +e rapids-logger "pytest pylibcudf" -pushd python/pylibcudf/pylibcudf/tests -python -m pytest \ - --cache-clear \ +./ci/run_pylibcudf_pytests.sh \ + --junitxml="${RAPIDS_TESTS_DIR}/junit-pylibcudf.xml" \ + --numprocesses=8 \ --dist=worksteal \ - . -popd + --cov-config=../.coveragerc \ + --cov=pylibcudf \ + --cov-report=xml:"${RAPIDS_COVERAGE_DIR}/pylibcudf-coverage.xml" \ + --cov-report=term rapids-logger "pytest cudf" ./ci/run_cudf_pytests.sh \ diff --git a/python/pylibcudf/.coveragerc b/python/pylibcudf/.coveragerc new file mode 100644 index 00000000000..11af8781634 --- /dev/null +++ b/python/pylibcudf/.coveragerc @@ -0,0 +1,3 @@ +# Configuration file for Python coverage tests +[run] +source = pylibcudf