daveleroy / SublimeDebugger

Graphical Debugger for Sublime Text for debuggers that support the debug adapter protocol
MIT License
369 stars 42 forks source link

pytest #194

Closed paulstretenowich closed 8 months ago

paulstretenowich commented 1 year ago

Hi, I just started using your nice plugin and I try to setup a call to pytest because if I run the debugger on a test.py in which there is just a function defined it doesn't stop at a breakpoint as the function should be called by pytest. I can share anything you might find relevant to help. Thanks in advance for the help!

daveleroy commented 1 year ago

I don't think debugpy has anything special for pytest.

Pretty sure you would have to use a script to run the test case with pytest and then debug that script.

daveleroy commented 1 year ago

That seems to be what the vscode-python extension does when using their test runner ui https://github.com/microsoft/vscode-python/blob/main/pythonFiles/testlauncher.py

paulstretenowich commented 1 year ago

Thanks for your answer! This was my guess too. I have to use something external of the debugger to trigger the pytest. I was wondering if I could configure the debugger to use either an external script or pytest itself for debugging and stop at breakpoints. So far using a snippet I found online is the only way for creating breakpoints and stopping a pytest call but it's not in Sublime unfortunately.

daveleroy commented 1 year ago

You should be able to just make a script like the vscode one I linked which calls pytest. You would then debug that script with whatever arguments you want sent to pytest to run the test you want.

daveleroy commented 1 year ago

Here is the list of configuration options you can use https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings

paulstretenowich commented 1 year ago

Thanks for your help, I'll see if I can have something working and share it here for others,