From c2fe0d41e29067e260ee48e97cd40e444e887dac Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 24 Nov 2025 21:45:05 -0800 Subject: [PATCH] Add --showlocals to all pytest configurations Add '--showlocals' option to pytest configurations across all projects to ensure consistent behavior when displaying local variables in test failures. Pytest does not merge addopts across configuration files - it uses the first configuration found. When running pytest from a subdirectory, the local pytest.ini or pyproject.toml takes precedence over the root config. To ensure --showlocals applies regardless of where pytest is invoked, we add it to each project's configuration: - Root pytest.ini: applies when running from repository root - cuda_core/pytest.ini: applies when running from cuda_core directory - cuda_bindings/pyproject.toml: appended to existing addopts - cuda_pathfinder/pyproject.toml: added new pytest.ini_options section This approach ensures uniform pytest behavior across all projects while maintaining the ability to run tests from any directory. --- cuda_bindings/pyproject.toml | 2 +- cuda_core/pytest.ini | 1 + cuda_pathfinder/pyproject.toml | 3 +++ pytest.ini | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index 4878879afb..4b3d30f968 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -69,5 +69,5 @@ repair-wheel-command = "delvewheel repair --namespace-pkg cuda -w {dest_dir} {wh [tool.pytest.ini_options] required_plugins = "pytest-benchmark" -addopts = "--benchmark-disable" +addopts = "--benchmark-disable --showlocals" norecursedirs = ["tests/cython", "examples"] diff --git a/cuda_core/pytest.ini b/cuda_core/pytest.ini index 2842d8a632..df1963f383 100644 --- a/cuda_core/pytest.ini +++ b/cuda_core/pytest.ini @@ -3,4 +3,5 @@ # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE [pytest] +addopts = --showlocals norecursedirs = cython diff --git a/cuda_pathfinder/pyproject.toml b/cuda_pathfinder/pyproject.toml index c18c204db2..b3b9ed2d0c 100644 --- a/cuda_pathfinder/pyproject.toml +++ b/cuda_pathfinder/pyproject.toml @@ -68,6 +68,9 @@ readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" } requires = ["setuptools>=64", "wheel"] build-backend = "setuptools.build_meta" +[tool.pytest.ini_options] +addopts = "--showlocals" + [tool.ruff] line-length = 120 preview = true diff --git a/pytest.ini b/pytest.ini index aed034dd54..0543760cd7 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 [pytest] +addopts = --showlocals norecursedirs = cuda_bindings/examples cuda_core/examples