Hello Floris, Thanks for your prompt reply (and sorry for my delayed one :).
I haven't had time to play more with the plugin but my observations (and Valentin in CC) has been that neither method was working for us. I haven't done my homework in terms of investigating this further (but I will next week) however, to answer your question the infinite loop looked like this: ------------------------------------------ import time def test_time_out(): counter = 0 while(1): print "hanging ...", counter counter += 1 time.sleep(1) ------------------------------------------ Neither with or without sigalarm worked (I am running on Ubuntu as I mentioned and Valentine tried it on Windows). Based on the code above, I think that both methods should work in that case. Don't worry about it as I will try to figure out what is going on (unless you can think of something). It is however a very nice addition to pytest, as in early development stages things do have a tendency to hang. Thanks /Laurent -----Original Message----- From: floris.bruynoo...@gmail.com on behalf of Floris Bruynooghe Sent: Wed 2/29/2012 2:31 AM To: Brack, Laurent P. Cc: py-dev@codespeak.net Subject: Re: [py-dev] New plugin: pytest-timeout Hello Laurent, On 28 February 2012 18:08, Brack, Laurent P. <lpb...@dolby.com> wrote: > Just wrote an infinite loop which never got preempted. I didn't have time to > dig any deeper. Does the test need to be executed in a separate process via > xdist? xdist is not needed, in fact I haven't tried it but assume it will behave fine. By default SIGALM will be used which does have it's limitations, the main issue is that it needs a chance to deliver the signal to python code. So depending on how your infinite loop is written this might be an issue and you may have to consider --nosigalrm which will use a timer thread (this is more expensive obviously). Could you show me the test function you where trying out? > Also, currently the time out applies to all tests (and defaults to 5 > minutes). I think it would be useful to be able to override the timeout > at the test level using markers. If something goes wrong and we have > thousands of tests (we use pytest to test embedded systems), this is an > awful lot of time to realize that things are DOA. Yes, I agree with this and it is noted in the TODO file that individual tests should have some control on the timeout and the mechanism used (timer vs sigalrm). But we only have about 10000 tests running nightly with normally none blocking, this plugin was written on the spur of the moment when we had about a dozen hanging and this minimal functionality seemed to do the job. It does assume hanging tests are an exception rather then the norm, certainly evident from the behaviour of --nosigalrm where os._exit() is called on a hanging test. I'm happy to work with you on adding a marker which will fulfil your needs however. Regards, Floris -- Debian GNU/Linux -- The Power of Freedom www.debian.org | www.gnu.org | www.kernel.org
_______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev