Fix some leaks/hangs on close: unstarted StreamInterface streams & TCP reader unblock

This commit is contained in:
Ian McEwen committed 2026-05-31 13:48:06 -07:00
1 parent c2a01f8294
commit ce5bbcda68
4 files changed
+43 -6

No files matched your search

+11
View File
@@ -33,6 +33,17 @@ def test_StreamInterface_close_safe_when_thread_never_started():
iface.close()
@pytest.mark.unit
@pytest.mark.usefixtures("reset_mt_config")
def test_StreamInterface_close_when_thread_never_started_closes_stream():
"""If no reader thread was started, close() should still close the stream."""
iface = StreamInterface(noProto=True, connectNow=False)
stream = MagicMock()
iface.stream = stream
iface.close()
stream.close.assert_called_once()
@pytest.mark.unit
@pytest.mark.usefixtures("reset_mt_config")
def test_StreamInterface_init_cleans_up_when_connect_raises():