-
Notifications
You must be signed in to change notification settings - Fork 225
Add --showlocals to all pytest configurations
#1286
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
Conversation
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.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/ok to test |
This comment has been minimized.
This comment has been minimized.
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
mdboom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Thanks @mdboom! |
|
Add
--showlocalsoption topytestconfigurations across all projects to ensure consistent behavior when displaying local variables in test failures.pytestdoes not mergeaddoptsacross configuration files - it uses the first configuration found. When runningpytestfrom a subdirectory, the localpytest.iniorpyproject.tomltakes precedence over the root config. To ensure--showlocalsapplies regardless of wherepytestis invoked, we add it to each project's configuration:pytest.ini: applies when running from repository rootcuda_core/pytest.ini: applies when running fromcuda_coredirectorycuda_bindings/pyproject.toml: appended to existingaddoptscuda_pathfinder/pyproject.toml: added newpytest.ini_optionssectionThis approach ensures uniform
pytestbehavior across all projects while maintaining the ability to run tests from any directory.Example behavior with
--showlocals: