This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sched.py module doesn't have a test suite
Type: Stage:
Components: Tests Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: giampaolo.rodola Nosy List: giampaolo.rodola, josiah.carlson, josiahcarlson, pitrou
Priority: normal Keywords: patch

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:00adminsetgithub: 52933
2010-08-04 09:30:04giampaolo.rodolasetstatus: open -> closed
resolution: fixed
messages: + msg112777

versions: - Python 2.7
2010-05-19 17:58:42giampaolo.rodolasetassignee: giampaolo.rodola
2010-05-12 23:58:50pitrousetmessages: + msg105615
2010-05-12 23:51:59giampaolo.rodolasetmessages: + msg105614
2010-05-12 23:49:03pitrousetmessages: + msg105613
2010-05-11 13:57:11giampaolo.rodolasetfiles: + test_sched.patch
keywords: + patch
messages: + msg105514
2010-05-11 13:07:31r.david.murrayunlinkissue8684 superseder
2010-05-11 13:07:31r.david.murraylinkissue8684 dependencies
2010-05-11 12:31:52giampaolo.rodolalinkissue8684 superseder
2010-05-11 12:28:04giampaolo.rodolacreate