diff --git a/meshtastic/tcp_interface.py b/meshtastic/tcp_interface.py index 25e5ab8..204872d 100644 --- a/meshtastic/tcp_interface.py +++ b/meshtastic/tcp_interface.py @@ -17,8 +17,6 @@ class TCPInterface(StreamInterface): hostname {string} -- Hostname/IP address of the device to connect to """ - # Instead of wrapping as a stream, we use the native socket API - # self.stream = sock.makefile('rw') self.stream = None self.hostname = hostname diff --git a/meshtastic/tests/test_tcp_interface.py b/meshtastic/tests/test_tcp_interface.py index 432caef..2848087 100644 --- a/meshtastic/tests/test_tcp_interface.py +++ b/meshtastic/tests/test_tcp_interface.py @@ -13,6 +13,7 @@ def test_TCPInterface(capsys): """Test that we can instantiate a TCPInterface""" with patch('socket.socket') as mock_socket: iface = TCPInterface(hostname='localhost', noProto=True) + iface.myConnect() iface.showInfo() iface.localNode.showInfo() out, err = capsys.readouterr() @@ -24,3 +25,11 @@ def test_TCPInterface(capsys): assert err == '' assert mock_socket.called iface.close() + + +@pytest.mark.unit +def test_TCPInterface_without_connecting(capsys): + """Test that we can instantiate a TCPInterface with connectNow as false""" + with patch('socket.socket'): + iface = TCPInterface(hostname='localhost', noProto=True, connectNow=False) + assert iface.socket is None