Repository navigation
How to use --pdbcls parameter to attach to VSCode Debugger #13096
Replies: 1 comment
|
This option: expects a class implementing the So: pytest --pdbcls=debugpy:launcherdoesn't attach pytest to VS Code because For VS Code/debugpy, start pytest under debugpy instead: python -m debugpy --listen 5678 --wait-for-client -m pytestor for a particular test: python -m debugpy \
--listen 5678 \
--wait-for-client \
-m pytest tests/test_example.py::test_exampleThen attach VS Code to: with a Python attach configuration. Once VS Code is attached, regular breakpoints in your test/application code can be used normally. You can also explicitly stop in the debugger with: import debugpy
debugpy.breakpoint()if appropriate. The distinction is: They solve different problems. If your goal is simply to debug a pytest test from VS Code, VS Code's Python testing integration can also launch the selected pytest test under its debugger directly, which avoids manually using Please mark this answer as accepted if it helped, thank you. |
Uh oh!
There was an error while loading. Please reload this page.
I've tried the following command:
pytest --pdbcls=debugpy:launcher, so that pytest will attach to the debugpy debugger, which is used in a VSCode python extension to debug python code. Nothing seems to happen. Anybody know the correct way to do it, so that it will attach to the debugger in VSCode?All reactions