66import platform
77import re
88import sys
9+ import types
910from unittest .mock import mock_open , MagicMock , patch
1011
1112import pytest
3536# from ..remote_hardware import onGPIOreceive
3637# from ..config_pb2 import Config
3738
39+ # create a fake termios for Wwindows, otherwise errors will occur
40+ if sys .platform == "win32" :
41+ fake_termios = types .ModuleType ("termios" )
42+ fake_termios .tcgetattr = lambda fd : None
43+ fake_termios .tcsetattr = lambda fd , when , settings : None
44+ sys .modules ["termios" ] = fake_termios
3845
3946@pytest .mark .unit
4047@pytest .mark .usefixtures ("reset_mt_config" )
@@ -2676,6 +2683,7 @@ def test_tunnel_no_args(capsys):
26762683 assert re .search (r"usage: " , err , re .MULTILINE )
26772684
26782685
2686+ @pytest .mark .skipif (sys .platform == "win32" , reason = "Linux is forced in test and no termios" )
26792687@pytest .mark .unit
26802688@pytest .mark .usefixtures ("reset_mt_config" )
26812689@patch ("meshtastic.util.findPorts" , return_value = [])
@@ -2699,6 +2707,7 @@ def test_tunnel_tunnel_arg_with_no_devices(mock_platform_system, caplog, capsys)
26992707 assert err == ""
27002708
27012709
2710+ @pytest .mark .skipif (sys .platform == "win32" , reason = "Linux is forced in test and no termios" )
27022711@pytest .mark .unit
27032712@pytest .mark .usefixtures ("reset_mt_config" )
27042713@patch ("meshtastic.util.findPorts" , return_value = [])
@@ -2722,6 +2731,7 @@ def test_tunnel_subnet_arg_with_no_devices(mock_platform_system, caplog, capsys)
27222731 assert err == ""
27232732
27242733
2734+ @pytest .mark .skipif (sys .platform == "win32" , reason = "Linux is forced in test and no termios" )
27252735@pytest .mark .unit
27262736@pytest .mark .usefixtures ("reset_mt_config" )
27272737@patch ("platform.system" )
0 commit comments