[TIP] What to do when a test is stuck

Doug Latornell doug at sadahome.ca
Mon Sep 7 08:44:14 PDT 2009


See nose.tools.timed
http://somethingaboutorange.com/mrl/projects/nose/0.11.1/testing_tools.html#module-nose.tools

Doug

On Mon, Sep 7, 2009 at 6:28 AM, yoav glazner<yoavglazner at gmail.com> wrote:
> Hi,
>
> I'm using Nose with Pymock.
> I have some tests that could result in an endless loop.
> how can termenate it after some time if no result was given?
>
> i wonder if there is  a decorator for these things, something like:
>
> @time_limit(5) # now this test should fail.
> def testMylooping(self):
>   while(True):
>     assert 1+1 == 2 ,'python told me that 1+1 != 2!!!'
>
>
> Thanks,
> Yoav.



More information about the testing-in-python mailing list