mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
Changes since 1.2.0: - Fix compatibility with Python 3.12 deprecation of datetime.utcnow() - Various minor bug fixes and improvements Also add test.sh to verify version and core scheduling API. Link: https://github.com/dbader/schedule/blob/master/CHANGELOG.rst Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
32 lines
660 B
Bash
Executable File
32 lines
660 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ "$1" = "python3-schedule" ] || exit 0
|
|
|
|
python3 - << EOF
|
|
import sys
|
|
import schedule
|
|
|
|
# Verify core scheduling API
|
|
results = []
|
|
|
|
def job():
|
|
results.append(1)
|
|
|
|
# Schedule a job and verify it is registered
|
|
schedule.every(1).hours.do(job)
|
|
assert len(schedule.jobs) == 1, "expected 1 job"
|
|
|
|
# run_pending should not call the job (not yet due)
|
|
schedule.run_pending()
|
|
assert len(results) == 0, "job should not have run yet"
|
|
|
|
# run_all forces all jobs to run regardless of schedule
|
|
schedule.run_all()
|
|
assert len(results) == 1, "job should have run via run_all"
|
|
|
|
schedule.clear()
|
|
assert len(schedule.jobs) == 0, "jobs should be cleared"
|
|
|
|
sys.exit(0)
|
|
EOF
|