Hi Floris, On Sat, Mar 17, 2012 at 18:31 +0100, Floris Bruynooghe wrote:
I've made a second release of the pytest-timeout plugin for py.test which can time out long running tests. This release includes a number of suggestions made on this list, major changes include:
* Fixed the activation problem * Set timeout using configuration file * Add a timeout marker to modify timeout of one item * The marker can also choose the method (signal/thread) * Renamed --nosigalrm to --timeout_method to future proof adding of eventlet and gevent timeout methods * Works on python 3, tested on 2.6, 2.7 and 3.2
Not yet done:
* Automatic enabling of the plugin, you still need to enable it on the command line or configuration file before you can use the marker. This was probably a bad idea but I felt bad about stealing a marker by default.
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. 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. 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. Moreover i'd eventually like to include the timeout plugin in pytest core. It's an important feature for functional testing.
* 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 cheers & thanks, holger
As before the release is on pypi: http://pypi.python.org/pypi/pytest-timeout and the development repository and issue tracker on bitbucket: https://bitbucket.org/flub/pytest-timeout/
I'd be pleased to receive any further feedback you may have.
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