Skip to content

Commit 757731a

Browse files
authored
ci: limit pytest duration reports to the slowest 20 tests (#2523)
* ci: limit pytest duration reports to the slowest 20 tests --durations=0 prints every test phase and floods CI logs. Report only the slowest 20 instead. * ci: set pytest --durations=20 via package config defaults Move the duration limit into pytest addopts so CI and local runs share one default, instead of repeating --durations on every command.
1 parent 4b13910 commit 757731a

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

.github/workflows/test-wheel-linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ jobs:
425425
if: ${{ inputs.test-mode == 'nightly-pytorch' }}
426426
run: |
427427
pushd cuda_core
428-
pytest -rxXs -v --durations=0 tests/test_utils.py tests/example_tests/
428+
pytest -rxXs -v tests/test_utils.py tests/example_tests/
429429
popd
430430
431431
- name: Run numba-cuda tests
@@ -485,7 +485,7 @@ jobs:
485485
--deselect 'tests/numba_cuda_tests/cudadrv/test_nvjitlink.py::TestLinkerDumpAssembly::test_nvjitlink_jit_with_linkable_code_lto_dump_assembly_warn'
486486
)
487487
fi
488-
pytest -rxXs -v --durations=0 \
488+
pytest -rxXs -v \
489489
--ignore=tests/benchmarks \
490490
--ignore=tests/doc_examples \
491491
"${DESELECTS[@]}" \
@@ -522,7 +522,7 @@ jobs:
522522
--deselect 'tests/test_enum_coverage.py::test_wrapper_covers_all_binding_members[NvlinkVersion]'
523523
)
524524
fi
525-
pytest -rxXs -v --durations=0 --randomly-dont-reorganize \
525+
pytest -rxXs -v --randomly-dont-reorganize \
526526
"${DESELECTS[@]}" \
527527
tests/
528528
popd

.github/workflows/test-wheel-windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ jobs:
409409
shell: bash --noprofile --norc -xeuo pipefail {0}
410410
run: |
411411
pushd cuda_core
412-
pytest -rxXs -v --durations=0 tests/test_utils.py tests/example_tests/
412+
pytest -rxXs -v tests/test_utils.py tests/example_tests/
413413
popd
414414
415415
- name: Run numba-cuda tests
@@ -452,7 +452,7 @@ jobs:
452452
--deselect 'tests/numba_cuda_tests/cudapy/test_cuda_array_interface.py::TestCudaArrayInterface::test_fortran_contiguous'
453453
)
454454
fi
455-
pytest -rxXs -v --durations=0 \
455+
pytest -rxXs -v \
456456
--ignore=tests/benchmarks \
457457
--ignore=tests/doc_examples \
458458
"${DESELECTS[@]}" \
@@ -494,7 +494,7 @@ jobs:
494494
--deselect 'tests/test_memory.py::test_non_managed_resources_report_not_managed[pinned]'
495495
)
496496
fi
497-
pytest -rxXs -v --durations=0 --randomly-dont-reorganize \
497+
pytest -rxXs -v --randomly-dont-reorganize \
498498
"${DESELECTS[@]}" \
499499
tests/
500500
popd

ci/tools/run-tests

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [[ "${test_module}" == "pathfinder" ]]; then
3636
"LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \
3737
"FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS} " \
3838
"BC:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_BITCODE_LIB_STRICTNESS}"
39-
pytest -ra -s -v --durations=0 tests/ |& tee /tmp/pathfinder_test_log.txt
39+
pytest -ra -s -v tests/ |& tee /tmp/pathfinder_test_log.txt
4040
# Report the number of "INFO test_" lines (including zero)
4141
# to support quick validations based on GHA log archives.
4242
line_count=$(awk '/^INFO test_/ {count++} END {print count+0}' /tmp/pathfinder_test_log.txt)
@@ -51,9 +51,9 @@ elif [[ "${test_module}" == "bindings" ]]; then
5151
pip install $(ls "${CUDA_BINDINGS_ARTIFACTS_DIR}"/*.whl)[all] --group test
5252
fi
5353
echo "Running bindings tests"
54-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/
54+
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize tests/
5555
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
56-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
56+
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize tests/cython
5757
fi
5858
popd
5959
elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
@@ -105,11 +105,11 @@ elif [[ "${test_module}" == "core" || "${test_module}" == nightly-* ]]; then
105105
echo "Installed packages before core tests:"
106106
pip list
107107
echo "Running core tests"
108-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/
108+
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize tests/
109109
# Currently our CI always installs the latest bindings (from either major version).
110110
# This is not compatible with the test requirements.
111111
if [[ "${SKIP_CYTHON_TEST}" == 0 ]]; then
112-
${SANITIZER_CMD} pytest -rxXs -v --durations=0 --randomly-dont-reorganize tests/cython
112+
${SANITIZER_CMD} pytest -rxXs -v --randomly-dont-reorganize tests/cython
113113
fi
114114
popd
115115
elif [[ "${test_module}" == "nightly-cuda-core" ]]; then

cuda_bindings/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ repair-wheel-command = "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wh
8989

9090
[tool.pytest.ini_options]
9191
required_plugins = "pytest-benchmark"
92-
addopts = "--benchmark-disable --showlocals"
92+
addopts = "--benchmark-disable --showlocals --durations=20"
9393
norecursedirs = ["tests/cython", "examples"]
9494
xfail_strict = true
9595
# Keep this authorship marker registry in sync across all pytest config roots.

cuda_core/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
[pytest]
6-
addopts = --showlocals
6+
addopts = --showlocals --durations=20
77
norecursedirs = cython
88
markers =
99
# Keep this authorship marker registry in sync across all pytest config roots.

cuda_pathfinder/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ tag_regex = "^cuda-pathfinder-(?P<version>v\\d+\\.\\d+\\.\\d+(?:[ab]\\d+)?)"
103103
git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--match", "cuda-pathfinder-v*[0-9]*" ]
104104

105105
[tool.pytest.ini_options]
106-
addopts = "--showlocals"
106+
addopts = "--showlocals --durations=20"
107107
thread_unsafe_fixtures = ['mocker']
108108
# Keep this authorship marker registry in sync across all pytest config roots.
109109
# Search for "agent_authored(model)" before editing.

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
[pytest]
5-
addopts = --showlocals
5+
addopts = --showlocals --durations=20
66
norecursedirs =
77
cuda_bindings/examples
88
cuda_core/examples

0 commit comments

Comments
 (0)