When I run pytest in the vscode debugger with "Uncaught Exceptions" checked, and there are test errors, no uncaught exceptions occur, because pytest catches them do its results reporting. How can I tell pytest to just let the exceptions happen? So that I can catch them in the vscode debugger?
Basically I want behavior like --pdb
but I want it to launch the vscode debugger not pdb. The flag --pdbcls
sounds promising but not sure what <module>:<class>
to give it.
Note: Normally I would just have it break on Raised Exceptions. But our code has tons of raised-but-caught exceptions so this option is not useful.
Here's a video of vscode not breaking when an AssertionError fires while debugging a pytest test:
@rioV8's suggestion below does break the on the exception, but for some reason there is no stack which means you can't debug from there:
I must be missing something because no one else seems to need this capability. But to me this seems like absolutely the most basic simplest thing one could do with a testing framework and a debugger: as a developer I want to debug from the point where the error is raised.
There must be some totally other way people are using a debugger with pytest, some obvious technique I'm overlooking.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…