[TIP] aborting tests that take too long

Michael Foord fuzzyman at voidspace.org.uk
Fri Nov 11 07:06:36 PST 2011


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

Michael

> 
> --
> Gary
> http://destroyallsoftware.com
> 
> 
> 
> On Thu, Nov 10, 2011 at 5:46 PM, Michael Foord
> <fuzzyman at voidspace.org.uk> wrote:
>> regrtest (from the Python test suite) on Python head has some interesting (and newish) code for aborting tests that take too long. May be worth taking a look at.
>> 
>> Michael
>> 
>> 
>> On 10 Nov 2011, at 15:28, Mark Sienkiewicz wrote:
>> 
>>> I have a general problem with tests that deadlock, go into an infinite loop, or otherwise just run for way too long.  I need to do something about this because it is starting to become a problem in my CI system.
>>> 
>>> When a test takes too long, I don't just want the test to fail if it takes too long -- I want it to be forced to stop running.  Is there some way to do this in py.test or nose?
>>> 
>>> Mark S.
>>> 
>>> 
>>> _______________________________________________
>>> testing-in-python mailing list
>>> testing-in-python at lists.idyll.org
>>> http://lists.idyll.org/listinfo/testing-in-python
>>> 
>> 
>> 
>> --
>> http://www.voidspace.org.uk/
>> 
>> 
>> May you do good and not evil
>> May you find forgiveness for yourself and forgive others
>> May you share freely, never taking more than you give.
>> -- the sqlite blessing
>> http://www.sqlite.org/different.html
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
>> 
> 


--
http://www.voidspace.org.uk/


May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing 
http://www.sqlite.org/different.html








More information about the testing-in-python mailing list