Refactor to remove pylint issues.

Since one of pylint's complains was that the globals module was
shadowing the built-in, and since the name `config` was already
is use in several modules, globals.py was renamed as mt_config.py.
All tests now pass, and the only remaining local pylint errors
relate to the protobuf code, I'm hoping this will make the PR
valid.
This commit is contained in:
Steve Holden
2024-04-10 17:42:44 +01:00
parent 0d57449030
commit a07e853f69
9 changed files with 291 additions and 290 deletions

View File

@@ -6,7 +6,7 @@ from unittest.mock import MagicMock
import pytest
from meshtastic import _onNodeInfoReceive, _onPositionReceive, _onTextReceive, globals
from meshtastic import _onNodeInfoReceive, _onPositionReceive, _onTextReceive, mt_config
from ..serial_interface import SerialInterface
@@ -15,7 +15,7 @@ from ..serial_interface import SerialInterface
def test_init_onTextReceive_with_exception(caplog):
"""Test _onTextReceive"""
args = MagicMock()
globals.args = args
mt_config.args = args
iface = MagicMock(autospec=SerialInterface)
packet = {}
with caplog.at_level(logging.DEBUG):
@@ -28,7 +28,7 @@ def test_init_onTextReceive_with_exception(caplog):
def test_init_onPositionReceive(caplog):
"""Test _onPositionReceive"""
args = MagicMock()
globals.args = args
mt_config.args = args
iface = MagicMock(autospec=SerialInterface)
packet = {"from": "foo", "decoded": {"position": {}}}
with caplog.at_level(logging.DEBUG):
@@ -40,7 +40,7 @@ def test_init_onPositionReceive(caplog):
def test_init_onNodeInfoReceive(caplog, iface_with_nodes):
"""Test _onNodeInfoReceive"""
args = MagicMock()
globals.args = args
mt_config.args = args
iface = iface_with_nodes
iface.myInfo.my_node_num = 2475227164
packet = {