Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix _SameTaskStreamingResponse disconnect test bypassing __init__ (#6627)

Daniel Han7a2526620353
diff --git a/tests/studio/test_stream_cancel_registration_timing.py b/tests/studio/test_stream_cancel_registration_timing.py
index 33deb7af9d6..7cfe9bf32c5 100644
--- a/tests/studio/test_stream_cancel_registration_timing.py
+++ b/tests/studio/test_stream_cancel_registration_timing.py
@@ -411,6 +411,8 @@ def test_same_task_response_closes_body_iterator_on_send_disconnect():
response = m["_SameTaskStreamingResponse"].__new__(m["_SameTaskStreamingResponse"])
response.body_iterator = agen
response.background = None
+ # __new__ bypasses __init__; __call__'s disconnect branch reads _unstarted_cleanup.
+ response._unstarted_cleanup = None
async def stream_response(_send):
raise OSError("client disconnected")