mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-01 12:02:05 +00:00
test(cli): deterministically join bg worker thread instead of polling deadline
test_background_task_registers_thread_local_approval_callbacks polled a 2s wall-clock deadline waiting for the background daemon thread to pop its entry from _background_tasks. Under loaded CI the thread's finally-block cleanup could lag the deadline, flaking the final 'assert not cli._background_tasks'. Join the actual worker thread (timeout=10) so the wait ends exactly when the thread finishes.
This commit is contained in:
parent
6148a9a3fe
commit
1cae1bd0de
1 changed files with 5 additions and 3 deletions
|
|
@ -354,9 +354,11 @@ class TestCliApprovalUi:
|
|||
chat_console.return_value.print = MagicMock()
|
||||
cli._handle_background_command("/btw check weather")
|
||||
|
||||
deadline = time.time() + 2
|
||||
while cli._background_tasks and time.time() < deadline:
|
||||
time.sleep(0.01)
|
||||
# Join the worker thread deterministically rather than polling a
|
||||
# wall-clock deadline — under load the thread's finally-block pop
|
||||
# of _background_tasks can lag a fixed timeout, which flaked CI.
|
||||
for _thread in list(cli._background_tasks.values()):
|
||||
_thread.join(timeout=10)
|
||||
|
||||
assert seen["approval"].__self__ is cli
|
||||
assert seen["approval"].__func__ is HermesCLI._approval_callback
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue