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
标题: sched.py module doesn't have a test suite
类型: Stage:
Components: Tests Versions: Python 3.2
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: giampaolo.rodola 抄送列表: giampaolo.rodola, josiah.carlson, josiahcarlson, pitrou
优先级: normal 关键字: 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.

文件
文件名 上传时间 Description 编辑
test_sched.patch giampaolo.rodola, 2010-05-11 13:57
Messages (6)
msg105503 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) 日期: 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) 日期: 2010-05-11 13:57
Patch in attachment.
msg105613 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 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) 日期: 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) 日期: 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) 日期: 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.
历史
日期 用户 动作 参数
2022-04-11 14:57:00admin修改github: 52933
2010-08-04 09:30:04giampaolo.rodola修改状态: open -> closed
resolution: fixed
消息: + msg112777

versions: - Python 2.7
2010-05-19 17:58:42giampaolo.rodola修改assignee: giampaolo.rodola
2010-05-12 23:58:50pitrou修改消息: + msg105615
2010-05-12 23:51:59giampaolo.rodola修改消息: + msg105614
2010-05-12 23:49:03pitrou修改消息: + msg105613
2010-05-11 13:57:11giampaolo.rodola修改文件: + test_sched.patch
keywords: + patch
消息: + msg105514
2010-05-11 13:07:31r.david.murray解链issue8684 superseder
2010-05-11 13:07:31r.david.murray链接issue8684 dependencies
2010-05-11 12:31:52giampaolo.rodola链接issue8684 superseder
2010-05-11 12:28:04giampaolo.rodola创建