mirror of
https://github.com/meshtastic/python.git
synced 2026-06-02 20:55:55 -04:00
Fix some leaks/hangs on close: unstarted StreamInterface streams & TCP reader unblock
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user