Repository navigation
Make pytest the shared entry point for local and CI Python tests #8925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
04af08e
399bd3a
220e2f2
9632c60
3f6cbac
df67cfa
aebab92
7f6b1cc
e2a926b
d0153c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Repository-local pytest defaults, shared by developers and CI adapters.""" | ||
|
|
||
| import copy | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| REPO = Path(__file__).resolve().parents[1] | ||
| PYTHON = REPO / "python/cuml" | ||
|
|
||
|
|
||
| def pytest_addoption(parser): | ||
| group = parser.getgroup("cuML options") | ||
| group.addoption( | ||
| "--cuml-suite", | ||
| choices=( | ||
| "standard", | ||
| "dask", | ||
| "accel", | ||
| "cudf-pandas", | ||
| ), | ||
| default="standard", | ||
| help=( | ||
| "Test suite and execution configuration. " | ||
| "standard (default) runs cuML's single-GPU Python tests, excluding " | ||
| "Dask and accelerator suites. " | ||
| "Explicit pytest targets replace the default collection target." | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| @pytest.hookimpl(tryfirst=True) | ||
| def pytest_load_initial_conftests(early_config, parser, args): | ||
| options = parser.parse_known_args(args) | ||
| suite = options.cuml_suite | ||
| targets = { | ||
| "standard": PYTHON / "tests", | ||
| "dask": PYTHON / "tests/dask", | ||
| "accel": PYTHON / "cuml_accel_tests", | ||
| "cudf-pandas": PYTHON / "tests", | ||
| } | ||
| # Let pytest parse its own arguments: -k/-m/-n and their values are not | ||
| # collection targets. Do not append a default to explicit selections. | ||
| if not options.file_or_dir: | ||
| args.append(str(targets[suite])) | ||
| if suite in ("standard", "cudf-pandas"): | ||
| args.append(f"--ignore={PYTHON / 'tests/dask'}") | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| if suite == "cudf-pandas": | ||
| early_config.pluginmanager.import_plugin("cudf.pandas") | ||
| from cudf.pandas import install | ||
|
|
||
| install() | ||
| _refresh_initial_args(early_config, parser, args) | ||
|
|
||
|
|
||
| def _refresh_initial_args(config, parser, args): | ||
| # Initial conftest discovery uses the pre-parsed namespace, not args. | ||
| # Keep both in sync so newly selected suites load their conftests early. | ||
| config.known_args_namespace = parser.parse_known_args( | ||
| args, namespace=copy.copy(config.known_args_namespace) | ||
| ) | ||
This file was deleted.
This file was deleted.
This file was deleted.
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We rely on these That's useful in local development, hardware bringup, DLFW builds, etc. That's why they were introduced in the first place: #5761 Can we please keep these? cross-ref: rapidsai/build-planning#269 |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # CPU-only tests of local runner behavior; no cuML build or GPU is needed. | ||
| set -euo pipefail | ||
| REPO=$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")") | ||
| cd "${REPO}" | ||
|
|
||
| source /opt/conda/etc/profile.d/conda.sh | ||
| rapids-logger "Create minimal runner-test environment" | ||
| rapids-mamba-retry create --yes --name local-runner-tests --override-channels \ | ||
| --channel conda-forge python=3.12 pytest packaging pyyaml cmake git | ||
| conda activate local-runner-tests | ||
|
|
||
| # The shared CPU workflow uploads this directory even when the script fails. | ||
| REPORT_DIR="${RAPIDS_ARTIFACTS_DIR:-${REPO}/artifacts}/local-runner-tests" | ||
| mkdir -p "${REPORT_DIR}" | ||
| export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 | ||
| python -m pytest ci/tests --junitxml="${REPORT_DIR}/junit.xml" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| [pytest] | ||
| addopts = -ra | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a LOT of complexity... do we really need If so I'd at least remove this file and just stick But IMO this whole |
||
Uh oh!
There was an error while loading. Please reload this page.