Skip to content

Commit 4ab8404

Browse files
authored
Add --showlocals to all pytest configurations (#1286)
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.
1 parent ca74d6d commit 4ab8404

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

cuda_bindings/pyproject.toml

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

7070
[tool.pytest.ini_options]
7171
required_plugins = "pytest-benchmark"
72-
addopts = "--benchmark-disable"
72+
addopts = "--benchmark-disable --showlocals"
7373
norecursedirs = ["tests/cython", "examples"]

cuda_core/pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
44

55
[pytest]
6+
addopts = --showlocals
67
norecursedirs = cython

cuda_pathfinder/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }
6868
requires = ["setuptools>=64", "wheel"]
6969
build-backend = "setuptools.build_meta"
7070

71+
[tool.pytest.ini_options]
72+
addopts = "--showlocals"
73+
7174
[tool.ruff]
7275
line-length = 120
7376
preview = true

pytest.ini

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

44
[pytest]
5+
addopts = --showlocals
56
norecursedirs =
67
cuda_bindings/examples
78
cuda_core/examples

0 commit comments

Comments
 (0)