mirror of
https://github.com/meshtastic/python.git
synced 2026-04-21 15:34:04 -04:00
fix errors and better linux/windows handling in tests
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
"""Meshtastic unit tests for serial_interface.py"""
|
||||
import platform
|
||||
# pylint: disable=R0917
|
||||
|
||||
import re
|
||||
import sys
|
||||
from unittest.mock import mock_open, patch
|
||||
|
||||
import pytest
|
||||
@@ -10,7 +10,6 @@ import pytest
|
||||
from ..serial_interface import SerialInterface
|
||||
from ..protobuf import config_pb2
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@patch("time.sleep")
|
||||
@patch("meshtastic.serial_interface.SerialInterface._set_hupcl_with_termios")
|
||||
@@ -28,11 +27,11 @@ def test_SerialInterface_single_port(
|
||||
iface.close()
|
||||
mocked_findPorts.assert_called()
|
||||
mocked_serial.assert_called()
|
||||
mock_hupcl.assert_called()
|
||||
|
||||
# doesn't get called in SerialInterface._set_hupcl_with_termios on windows
|
||||
if platform.system() != "Windows":
|
||||
# doesn't get called in SerialInterface on windows
|
||||
if sys.platform != "win32":
|
||||
mocked_open.assert_called()
|
||||
mock_hupcl.assert_called()
|
||||
|
||||
mock_sleep.assert_called()
|
||||
out, err = capsys.readouterr()
|
||||
|
||||
Reference in New Issue
Block a user