test: add apply_schedule() unit tests + pycache gitignore
apply_schedule() was the actual behavioral fix in the prior commit but shipped without tests. Six new pytest cases now cover its five+ state combinations: - manual mode with an existing crontab + live crond pid -> crontab removed, SIGHUP sent - manual mode with no crontab and no pid file -> no-op (function returns cleanly) - real schedule with a live pid -> crontab written, SIGHUP sent - real schedule with a dead pid (ProcessLookupError) -> crontab written, fresh crond spawned, new pid file - real schedule with no pid file (e.g. container started in manual mode, user enables a schedule via UI) -> crontab written, fresh crond spawned - real schedule with a garbage pid file (non-integer contents) -> ValueError caught, fresh crond spawned os.kill and subprocess.Popen are mocked so no real signals fire and no real processes spawn during tests. CRONTAB_FILE / CROND_PID_FILE are redirected to tmp paths via monkeypatch. .gitignore: add __pycache__/, *.pyc, and .pytest_cache/ to prevent future contributors from accidentally committing test artifacts.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,6 +5,9 @@
|
||||
test/
|
||||
downloads/
|
||||
config/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.pytest_cache/
|
||||
|
||||
# Editor
|
||||
.vscode/
|
||||
|
||||
Reference in New Issue
Block a user