[TIP] aborting tests that take too long

Michael Foord fuzzyman at voidspace.org.uk
Fri Nov 11 06:49:52 PST 2011


On 11 Nov 2011, at 01:46, Michael Foord 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.
> 

RIght, after a bit of investigation, the new timeout feature of regrtest uses the faulthandler module and kills the test (dumping the traceback) after a specified time:

	http://hg.python.org/cpython/file/bd5c4dda6ad0/Lib/test/regrtest.py#l852

	timeout -- dump the traceback and exit if a test takes more than timeout seconds

	http://pypi.python.org/pypi/faulthandler/

faulthandler should be usable from any test framework.

All the best,

Michael Foord



> 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