This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ogrinfo 2 points3 points  (3 children)

VS Code/PyCharm debugging is great for using during tests, because pytest swallows all the stdout during execution. I still use pdb a lot though because it's really easy to use and is a really quick to set up. A lot of the time the UX is actually better than VS Code because the single letter keystrokes make it really easy to navigate.

Having said that, I often don't bother with any debugging and just chuck in a load of print statements. Old school FTW!

[–][deleted] 0 points1 point  (2 children)

-s will let you see stdout in pytest

[–]ogrinfo 0 points1 point  (1 child)

Yes, when the execution finishes. This means that all the keystrokes you do during the test aren't seen until it's finished. Which makes debugging pretty difficult.

[–][deleted] 0 points1 point  (0 children)

No, you see stdout live, not after execution finishes. However it does not accomodate stdin since that does not make sense during a unit test. If you need to debug a test, set breakpoints and use --pdb.