Issue 8687: sched.py module doesn't have a test suite (original) (raw)

Created on 2010-05-11 12:28 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_sched.patch giampaolo.rodola,2010-05-11 13:57
Messages (6)
msg105503 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-05-11 12:28
sched.py module is currently lacking a test suite. Possibly this should be resolved before fixing issue 8684.
msg105514 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-05-11 13:57
Patch in attachment.
msg105613 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-12 23:49
You know, one benefit of having user-settable sleep() and time() functions is that you can mock them easily, and therefore check that sched.py really schedules callables at the right intervals.
msg105614 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-05-12 23:51
I agree. Are you recommending to take advantage of this and change the tests in some way?
msg105615 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-12 23:58
> 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.
msg112777 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-08-04 09:30
Committed as r83707 without including the mock time tests for now. I'll see whether I can manage to write them at a later time.
History
Date User Action Args
2022-04-11 14:57:00 admin set github: 52933
2010-08-04 09:30:04 giampaolo.rodola set status: open -> closedresolution: fixedmessages: + versions: - Python 2.7
2010-05-19 17:58:42 giampaolo.rodola set assignee: giampaolo.rodola
2010-05-12 23:58:50 pitrou set messages: +
2010-05-12 23:51:59 giampaolo.rodola set messages: +
2010-05-12 23:49:03 pitrou set messages: +
2010-05-11 13:57:11 giampaolo.rodola set files: + test_sched.patchkeywords: + patchmessages: +
2010-05-11 13:07:31 r.david.murray unlink issue8684 superseder
2010-05-11 13:07:31 r.david.murray link issue8684 dependencies
2010-05-11 12:31:52 giampaolo.rodola link issue8684 superseder
2010-05-11 12:28:04 giampaolo.rodola create