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().