Skip to content
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

Add pytest configuration for break on exception #121

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

GDYendell
Copy link
Contributor

Pytest nicely catches raised exceptions during tests and reports them at the end. This is very useful except when debugging tests in vscode because it prevents the debugger from pausing when there is an exception and displaying the call stack.

This adds hooks for pytest to re-raise the caught exceptions when an environment variable is set, and then sets that environment variable in the Debug Unit Test launch configuration.

This is currently used in pvi.

@GDYendell GDYendell requested a review from coretl February 29, 2024 17:03
@GDYendell GDYendell changed the title Add pytest configuration for pause on exception Add pytest configuration for break on exception Feb 29, 2024
@GDYendell GDYendell force-pushed the debug-break-on-exception branch from c4bcca2 to 52f84a9 Compare March 1, 2024 09:56
Pytest nicely catches raised exceptions during tests and reports them
at the end. This is very useful except when debugging tests in vscode
because it prevents the debugger from pausing when there is an exception
and displaying the call stack.

This adds hooks for pytest to re-raise the caught exceptions when an
environment variable is set, and then sets that environment variable
in the `Debug Unit Test` launch configuration.
@GDYendell GDYendell force-pushed the debug-break-on-exception branch from 52f84a9 to 39622d8 Compare March 1, 2024 10:03
@coretl coretl merged commit 377554a into main Mar 1, 2024
12 checks passed
@coretl coretl deleted the debug-break-on-exception branch March 1, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants