Skip to content

The agent that grows with you

test(uninstall): close the control-socket test loop after the thread joins

Teknium2140fdaef1df
diff --git a/tests/hermes_cli/test_data_uninstall_holders.py b/tests/hermes_cli/test_data_uninstall_holders.py
index c6ba7bbcc74..75df4d2971a 100644
--- a/tests/hermes_cli/test_data_uninstall_holders.py
+++ b/tests/hermes_cli/test_data_uninstall_holders.py
@@ -86,7 +86,8 @@ def test_manual_gateway_drains_over_real_control_transport_before_deletion(layou
if started:
loop.run_forever()
loop.run_until_complete(server.stop())
- loop.close()
+ # The loop is closed by the test after join: drain() stops it from the control
+ # thread, so the finally block's call_soon_threadsafe can race a close here.
thread = Thread(target=serve, daemon=True)
thread.start()
@@ -103,6 +104,7 @@ def test_manual_gateway_drains_over_real_control_transport_before_deletion(layou
loop.call_soon_threadsafe(loop.stop)
thread.join(timeout=10)
assert not thread.is_alive()
+ loop.close()
@pytest.mark.parametrize("profile", ["", "sibling"])