[py-dev] pytest-timeout 0.2

Floris Bruynooghe flub at devork.be
Mon Mar 19 00:24:07 CET 2012

Hello Holger,

On 18 March 2012 00:16, holger krekel <holger at merlinux.eu> wrote:
> I went ahead and created a test function with
>    @pytest.mark.timeout(1)
>    def test_hello():
>        ...
> but the timeout was not honoured.  Then i skimmed the docs :)
> added "timeout_method = signal" to my ini-file and ran, still not honoured.
> Then i figured i need to set some dummy "timeout = 10" in the ini - and now
> i get the proper timeout of 1 second.

Actually timeout=0 would be fine too.

> I understand the hesitance to grab a general name like "timeout" but then
> again installing "pytest-timeout" is a deliberate act and it grabbing the
> "timeout" marker is not surprising IMO.  So i'd kindly encourage you to
> go for it. I wonder btw. if the output of "--markers" should be merged with
> "--help".  The latter would get yet longer but then again it's nice to
> have all the info at a fingertip.

In fact I had no idea --markers existed, I was considering brining
this up but I just hadn't looked around enough!  This does make me
feel a lot better about using the timeout marker and you've convinced
me it's outweighs the stumbling blocks of requiring --timeout=0.

> Another feedback item: "@pytest.mark.timeout(5, 'signal')" ought to work.
> It's slightly awkward because of the marker args/kwargs API but it's expected
> from a pure user perspective i think.

Yes, I did consider that but then python3 allows keyword only
arguments and this seemed a reasonable candidate while the api to make
it lends itself to it naturally.  But don't see any problem with
making it positional as well and am happy to add this.

> Moreover i'd eventually like to include the timeout plugin
> in pytest core.  It's an important feature for functional testing.

That would be nice!  But as you implied it probably needs to mature a
bit more outside of pytest core first.

>> * eventlet and gevent timeouts
> Here is what i did for eventlet (only accessing the decorator here):
> https://bitbucket.org/hpk42/detox/src/f9f8c0107cc1/tests/conftest.py#cl-108

Thanks for that hint, hadn't started looking yet but this will save me
some experimenting.


Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org

More information about the Pytest-dev mailing list