[Twisted-Python] Simulating time for reactor

Itamar Shtull-Trauring itamar at itamarst.org
Mon Jan 12 12:06:00 MST 2004


On Mon, 2004-01-12 at 12:35, David Bolen wrote:

> For example, if IReactorCore included a now() or time() method which
> was the only way it grabbed system time, then tests could mock up a
> reactor to be installed at the start of a test and just override that
> one method to control time.  From looking at base.py in the Twisted
> distribution for example, it only appears that a few uses of
> time.time() would have to be tweaked.

This still wouldn't alter how long e.g. select() waits, but since that
has maximum timeouts you'd probably be fine with just changing the time
to be 30 secs in the future, yeah.

-- 
Itamar Shtull-Trauring    http://itamarst.org
Looking for a job: http://itamarst.org/resume.html





More information about the Twisted-Python mailing list