Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ci: run numba-cuda tests from checked-out source, mirroring mlir
Same shape as the numba-cuda-mlir step. run-tests exposes
NUMBA_CUDA_VER; the workflow checks out NVIDIA/numba-cuda at the
matching tag and runs pytest from numba-cuda-released/testing/, so
upstream's testing/pytest.ini kicks in
(consider_namespace_packages=true + --pyargs numba.cuda.tests) and
we stop caring about the site-packages namespace-package layout.

Also mirror the wheel-only gate: in wheels mode, set
NUMBA_CUDA_TEST_WHEEL_ONLY=1 so numba-cuda skips tests that need
CTK executables. Binary-generated tests self-skip via
`@unittest.skipIf(not NUMBA_CUDA_TEST_BIN_DIR, ...)`, so no
`make -j` step is needed — mirrors mlir, which has no Makefile.

Drops the --import-mode=importlib workaround from the prior commit;
pytest.ini's consider_namespace_packages does the job.
  • Loading branch information
leofang committed Sep 30, 2026
commit 3bc4accbf59569f420c860eab1eee5f01c666244
27 changes: 20 additions & 7 deletions .github/workflows/test-wheel-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,18 +467,31 @@ jobs:
pytest -rxXs -v tests/test_utils.py tests/example_tests/
popd

- name: Checkout numba-cuda tests at matching tag
if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: NVIDIA/numba-cuda
ref: v${{ env.NUMBA_CUDA_VER }}
path: numba-cuda-released

- name: Run numba-cuda tests
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }}
env:
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: |
# --import-mode=importlib: numba-cuda's on-disk layout is
# site-packages/numba_cuda/numba/cuda/tests/... where numba/ is a
# namespace subdir (no __init__.py). Default prepend import mode
# stops there and imports each test file as `cuda.tests.<...>`,
# which collides with cuda-bindings' top-level cuda package.
if [[ "${LOCAL_CTK}" != 1 ]]; then
# Let numba-cuda skip inputs that require toolkit executables.
export NUMBA_CUDA_TEST_WHEEL_ONLY=1
fi
# Run from numba-cuda's testing/ dir so its pytest.ini kicks in
# (consider_namespace_packages=true + --pyargs numba.cuda.tests).
# test_ipc: numba-cuda v0.30.4 accesses CUipcMemHandle.reserved, which
# cuda-bindings intentionally removed. numba-cuda is EOL upstream, so
# no fix is coming. See cuda-python#2748.
pytest -v --import-mode=importlib --pyargs numba.cuda.tests --ignore-glob="**/test_ipc.py"
pushd numba-cuda-released/testing
pytest -v --ignore-glob="**/test_ipc.py"
popd

- name: Checkout numba-cuda-mlir tests at matching tag
if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }}
Expand Down
21 changes: 18 additions & 3 deletions .github/workflows/test-wheel-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,27 @@ jobs:
pytest -rxXs -v tests/test_utils.py tests/example_tests/
popd

- name: Checkout numba-cuda tests at matching tag
if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: NVIDIA/numba-cuda
ref: v${{ env.NUMBA_CUDA_VER }}
path: numba-cuda-released

- name: Run numba-cuda tests
if: ${{ inputs.test-mode == 'nightly-numba-cuda' }}
if: ${{ inputs.test-mode == 'nightly-numba-cuda' && env.NUMBA_CUDA_VER != '' }}
env:
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
shell: bash --noprofile --norc -xeuo pipefail {0}
run: |
# See linux step for rationale on --import-mode and the test_ipc skip.
pytest -v --import-mode=importlib --pyargs numba.cuda.tests --ignore-glob="**/test_ipc.py"
if [[ "${LOCAL_CTK}" != 1 ]]; then
export NUMBA_CUDA_TEST_WHEEL_ONLY=1
fi
# See linux step for rationale on running from testing/ and the test_ipc skip.
pushd numba-cuda-released/testing
pytest -v --ignore-glob="**/test_ipc.py"
popd

- name: Checkout numba-cuda-mlir tests at matching tag
if: ${{ inputs.test-mode == 'nightly-numba-cuda-mlir' && env.NUMBA_CUDA_MLIR_VER != '' }}
Expand Down
9 changes: 9 additions & 0 deletions ci/tools/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
if [[ -n "${GITHUB_ENV:-}" ]]; then
echo "NUMBA_CUDA_MLIR_VER=${installed_ver}" >> "${GITHUB_ENV}"
fi
elif [[ "${test_module}" == "nightly-numba-cuda" ]]; then
# Expose the installed numba-cuda version so the workflow can
# actions/checkout the matching v<X.Y.Z> tag from NVIDIA/numba-cuda
# (the wheel does not ship test_*.py files at a pytest-discoverable
# top level; upstream's testing/pytest.ini is required to run them).
installed_ver=$(pip show numba-cuda | awk '/^Version:/{print $2}')
if [[ -n "${GITHUB_ENV:-}" ]]; then
echo "NUMBA_CUDA_VER=${installed_ver}" >> "${GITHUB_ENV}"
fi
fi
fi
fi
Loading