[TIP] aborting tests that take too long

Martin Pool mbp at sourcefrog.net
Mon Nov 28 18:10:59 PST 2011


On 11 November 2011 02:28, Mark Sienkiewicz <sienkiew at stsci.edu> 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?

I have just proposed a fixture for this in Python fixtures:

https://code.launchpad.net/~mbp/python-fixtures/timeout/+merge/83721

  self.useFixture(Timeout(20, gentle=False))

or

  with Timeout(30, gentle=True):

-- 
Martin



More information about the testing-in-python mailing list