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 d
The behavior is not identical but the test runner stops at the uncaught exception.
Add the file conftest.py
to the directory with your tests.
# conftest.py
def pytest_exception_interact(node, call, report):
print( call.excinfo.traceback[0] )
pass
This adds a hook for any uncaught exceptions.
Place a break point at the line with pass
.
Then Debug
the test.
Look in the Debug console and you see the file and line number where the exception happened.
test_example.py F File 'path\\test_example.py':4 in test_example
assert False
And the debugger stops at the pass
line.
You can make this hook function as fancy as you like.