The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(cron): exercise scheduled identity through the worker entry point
Teknium8aa7ae4f236c
diff --git a/tests/cron/test_scheduled_occurrence.py b/tests/cron/test_scheduled_occurrence.pyindex afa85449ca4..9134465e75f 100644--- a/tests/cron/test_scheduled_occurrence.py+++ b/tests/cron/test_scheduled_occurrence.py@@ -9,6 +9,10 @@ import pytest_FIRE = """+import json+import os+from pathlib import Path+import subprocessimport sysfrom cron import jobs, schedulerfrom cron.scheduler_provider import InProcessCronScheduler@@ -17,7 +21,23 @@ if sys.argv[1] == 'builtin':else:provider = InProcessCronScheduler()for job in jobs.load_jobs():- provider.fire_due(job['id'], force=sys.argv[1] == 'manual')+ if sys.argv[1] != 'worker':+ provider.fire_due(job['id'], force=sys.argv[1] == 'manual')+ continue+ from cron.executions import mark_execution_handoff_pending+ claim = provider.claim_fire(job['id'])+ if claim is None:+ continue+ mark_execution_handoff_pending(claim['execution_id'])+ home = Path(os.environ['HERMES_HOME'])+ payload = home / (claim['execution_id'] + '.json')+ ack = home / (claim['execution_id'] + '.ready')+ payload.write_text(json.dumps({'job': claim, 'profile_home': str(home),+ 'multiplex_active': False}))+ subprocess.run([sys.executable, '-m', 'cron.scheduler',+ '--external-worker-file', str(payload), '--ack-file', str(ack)],+ stdin=subprocess.DEVNULL, check=True, timeout=60)+ assert json.loads(ack.read_text())['pid'] != os.getpid()"""@@ -32,7 +52,7 @@ def _fire(home, mode):assert result.returncode == 0, result.stdout + result.stderr[email protected]('mode', ['builtin', 'provider'])[email protected]('mode', ['builtin', 'provider', 'worker'])def test_completed_occurrence_survives_restart_and_prestamp_rollback(tmp_path, mode):from datetime import timedeltafrom hermes_time import now