last PR introduced some test failures in: [code] pls fix
- User
last PR introduced some test failures in:
codeFAILED lib/zephyr/tests/test_execution.py::test_no_duplicate_results_on_heartbeat_timeout[local] - RuntimeError: current_actor() called outside of an actor context FAILED lib/zephyr/tests/test_execution.py::test_no_duplicate_results_on_heartbeat_timeout[iris] - RuntimeError: current_actor() called outside of an actor context FAILED lib/zephyr/tests/test_execution.py::test_no_duplicate_results_on_heartbeat_timeout[ray] - RuntimeError: current_actor() called outside of an actor context FAILED lib/zephyr/tests/test_execution.py::test_status_reports_alive_workers_not_total - RuntimeError: current_actor() called outside of an actor context FAILED lib/zephyr/tests/test_execution.py::test_coordinator_accepts_winner_ignores_stale - RuntimeError: current_actor() called outside of an actor context FAILED lib/zephyr/tests/test_execution.py::test_wait_for_stage_fails_when_all_workers_die - RuntimeError: current_actor() called outside of an actor context FAILED lib/zephyr/tests/test_execution.py::test_wait_for_stage_resets_dead_timer_on_recovery - RuntimeError: current_actor() called outside of an actor contextpls fix
Assistant
Let me look at the failing tests and the recent commit that likely caused the issue.
Assistant
The last commit looks harmless. Let me check the
reprcommit which is more likely the cause.Assistant
Found it. The
reprcommit addedcurrent_actor()toZephyrCoordinator.__init__, which fails when the coordinator is created outside an actor context (i.e., in tests). One test was patched but the failing tests weren't.Let me look at the failing tests and the
current_actorAPI.Assistant
The problem is clear:
ZephyrCoordinator.__init__now callscurrent_actor()unconditionally, but these tests construct the coordinator directly (not inside an actor). The fix is to make thecurrent_actor()call graceful with a fallback.Assistant
Let me look at how the existing patched test does it to replicate the pattern.
Assistant
I'll create a fixture and update all the failing tests.
Assistant
I'll add a pytest fixture that sets up the actor context, and use it in all tests that directly instantiate
ZephyrCoordinator. Let me also check the conftest for existing fixtures.Assistant
I'll add a fixture in conftest.py and update the 5 failing tests plus clean up the already-patched test.
Assistant
Now update the 5 failing tests to use the fixture, and clean up the already-patched test.
Assistant
Now let me also clean up
test_pull_task_returns_shutdown_on_last_stage_empty_queuewhich had the inline pattern:Assistant
Let me check if there are any other tests with bare
ZephyrCoordinator()that I missed.Assistant
All 6 sites now have
actor_contextin their function signature. Let me run the failing tests.Assistant
All 8 tests pass. Added an
actor_contextfixture to conftest.py and used it in the 6 tests that directly instantiateZephyrCoordinator— including cleaning up the inline_set_current_actor/_reset_current_actorpattern intest_pull_task_returns_shutdown_on_last_stage_empty_queue.