DiamondLightSource / python-copier-template

Diamond's opinionated copier template for pure Python projects managed by pip
Apache License 2.0
4 stars 2 forks source link

Add pytest configuration for break on exception #121

Closed GDYendell closed 6 months ago

GDYendell commented 6 months ago

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.