[TIP] aborting tests that take too long
sienkiew at stsci.edu
Fri Nov 11 07:54:36 PST 2011
On 11/11/11 10:06, Michael Foord wrote:
> On 11 Nov 2011, at 01:54, Gary Bernhardt wrote:
>> I can't resist...
>> os.system("(sleep 30&& kill %s)&" % os.getpid())
> That would require running each test in a separate process (or providing a test *run* timeout rather than a test timeout) - which faulthandler doesn't. :-p
It's a bit weak in the reporting area too. :)
Seriously, though, I AM going to implement something similar. In my system a "test run" involves hundreds of processes running tests with many different test runners. If a particular instance of a test runner does not implement time limits, the control system can kill it eventually. So, first level is that faulthandler can interrupt a particular test and report what test ran over, second level is a test runner can get killed and report what file ran over, and third level is that the CI system can decide that the set of all tests is taking too long.
Now, all I have to do now is implement all that...
More information about the testing-in-python