Skip to content

Commit b414083

Browse files
committed
新增schedule模块测试
1 parent 045ff2e commit b414083

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

test/test_schedule.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
"""
5+
@author: zhanghe
6+
@software: PyCharm
7+
@file: test_schedule.py
8+
@time: 2016/10/20 下午5:17
9+
"""
10+
11+
12+
import schedule
13+
import time
14+
15+
16+
def job():
17+
print("I'm working...")
18+
19+
20+
def run():
21+
schedule.every(10).minutes.do(job)
22+
schedule.every().hour.do(job)
23+
schedule.every().day.at("10:30").do(job)
24+
schedule.every().monday.do(job)
25+
schedule.every().wednesday.at("13:15").do(job)
26+
27+
while True:
28+
schedule.run_pending()
29+
time.sleep(1)
30+
31+
32+
if __name__ == '__main__':
33+
run()
34+
35+
"""
36+
$ pip install schedule
37+
38+
python 版本的定时调度
39+
"""

0 commit comments

Comments
 (0)