Wishlist: unit testing with a manual clock

51 views
Skip to first unread message

Michael Elsdörfer

unread,
Apr 14, 2012, 11:56:59 AM4/14/12
to gev...@googlegroups.com
I am porting unit tests from a relatively big Twisted app to gevent. Those involve *a lot* of testing of different timeouts, and thus a lot of sleeping. I am setting all the timeouts to very low values (fractions of a second), and this works well enough.

Still, Twisted supports an internal clock can be manually advanced (http://twistedmatrix.com/documents/11.1.0/api/twisted.internet.task.Clock.html), which would be very useful here. It would seem to me that in theory anyway the same thing should be possible for gevent. I had a look at libev and on first glance it doesn't seem like there is anything there to help, but maybe it could be implemented on top of libev, by replacing gevent.sleep() and things like core.timer().

Just wanted to put it out there for now, but any thoughts are welcome.

Michael Elsdörfer

unread,
Apr 15, 2012, 10:04:23 AM4/15/12
to gev...@googlegroups.com
Debugging also doesn't work well with (small) timeout values.
Reply all
Reply to author
Forward
0 new messages