Has anyone released a mock time module?

Peter Hansen peter at engcorp.com
Thu Nov 4 21:37:42 EST 2004


Along the lines of my post just now about a mock filesystem,
I'm also interested in any work in the area of mock
timing.

Testing time-based* systems can be a real bitch.  The
most annoying part is that the naive approach generally
involves tests waiting for the code under test to complete,
thus making the tests waste time just sitting there.  When
your tests take too long to run, you think twice about
running them often which is inevitably a Bad Thing.

As with the mockfs, I have a simple mocktime working,
allowing me to quickly and easily test time-based behaviour
in threaded code.  I suspect others have been here before,
and I'd like to stand on their shoulders, or at least
get a little piggyback ride for a bit.

Thanks again for any pointers to similar efforts.

-Peter

* By "time-based" I mean code that does things like time.sleep()
or time.time(), in essence.



More information about the Python-list mailing list