[issue8687] sched.py module doesn't have a test suite

Antoine Pitrou report at bugs.python.org
Thu May 13 01:58:51 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> I agree. Are you recommending to take advantage of this and change the
> tests in some way?

Yes, it would allow you to check that if you have e.g. :
- A scheduled in 1 s
- B scheduled in 3 s

sched.py first sleeps for 1 s, then calls A, then sleeps for 2 s, then
calls B

Twisted has a full-blown utility class that they use in many tests,
allowing them to mock time.time():
http://twistedmatrix.com/documents/10.0.0/api/twisted.internet.task.Clock.html
You probably don't need something as sophisticated, the idea of a class
with advance() and time() methods is probably enough.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8687>
_______________________________________


More information about the Python-bugs-list mailing list