Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
test(gateway): make concurrency check deterministic
Xubin Ren301d039fbb08
diff --git a/tests/gateway/test_runtime.py b/tests/gateway/test_runtime.pyindex 6857af870..c570de337 100644--- a/tests/gateway/test_runtime.py+++ b/tests/gateway/test_runtime.py@@ -214,7 +214,7 @@ def test_concurrent_background_starts_create_only_one_process(tmp_path, monkeypareturn FakeProcess()def first_sleep(_seconds):- assert release_first.wait(timeout=2)+ release_first.wait()first = GatewayRuntime(paths=_paths(tmp_path),@@ -240,12 +240,20 @@ def test_concurrent_background_starts_create_only_one_process(tmp_path, monkeypatarget=lambda: results.append(second.start_background(GatewayStartOptions(port=18790))))+ second_started = Falsefirst_thread.start()- assert first_spawned.wait(timeout=2)- second_thread.start()- release_first.set()- first_thread.join(timeout=2)- second_thread.join(timeout=2)+ try:+ assert first_spawned.wait(timeout=10)+ second_thread.start()+ second_started = True+ finally:+ release_first.set()+ first_thread.join(timeout=10)+ if second_started:+ second_thread.join(timeout=10)++ assert not first_thread.is_alive()+ assert not second_thread.is_alive()assert len(calls) == 1assert sorted((result.ok, result.message) for result in results) == [