All Posts
pytest: dealing with halting tests
- 21 April 2021
Besides using –durations option, which does not seem to show the interrupted halted tests, one possible way to deal with halting tests is to use pytest-timeout. However, it does not work with pytest-xdist, which a large issue when you are refactoring a large codebase with lots of tests and not ready to wait 5x times longer.
Fortunately, pytest is an excellent rich framework and provides a concept of hooks. And so to deal with this problem it is possible to use pytest_runtest_call hook to write to a file a time when a test started and when it ended. With this, it should be easy to figure out most of the halting tests in one go.
Pdb Driven Development
- 02 December 2016
The most important command of pdb module that you should know is set_trace method, it enters the debugger at the calling stack frame at a given point in a program, and so far it’s the only piece of code that you should not be ashamed to copy-paste:
When you are in debugger there is a set of command that will help you investigate the scope: