Closely related to my question is VSCode: how to interrupt a running Python test?, however in my case the standard method of pressing the square in the Test Results tap does not work.
What is different in my tests?
I have code that via multiprocessing (and os.fork) executes multiple sub processes. There are two issues that cause the tests to be stuck.
One, because of the forking (involving JAX) a deadlock happens when several tests are executed in one set, this seems to be a limitation of unittest cleanup.
Secondly, I might have a breakpoint in code that is executed in these other processes.
Additionally is a custom debugger in place of the standard pdb that would allow debugging and hooking into these processes when executed normally - but not when using tests. To be precise I am using ray's distributed debugger and the last message I get is that the debugger is now active. This prevents the tests from being stopped in the normal way via the square button.
I tried to kill some running python processes but there is a long list of processes that are running, I don't know which is the correct to select.
Is there another integrated method that allows to immediately terminate a running test that will work in my case? For example shutdown and restart the test console (process).
ps aux | grep python > file.txtbefore running test and compare file with the same command when test is running - you will see what to search next time. If you will have two files then you may try to compare them with commanddiffor use GUI program like meldbreakpointstatement. As I do not know this beforehand I would need to automate the process grabbing to be done before all tests. hmm. If a normal process is stuck I can just end the shell its running in, is there anything similar for the inbuilt tests?