mirror of
https://github.com/meshtastic/python.git
synced 2026-01-18 20:57:57 -05:00
Begin to rationalise test data.
Also refactor to silence some CI issues.
This commit is contained in:
@@ -15,6 +15,7 @@ with rather more easily once the code is simplified by this change.
|
||||
|
||||
def reset():
|
||||
"""
|
||||
Restore the namespace to pristine condition.
|
||||
"""
|
||||
global args, parser, channel_index, logfile, tunnelInstance, camel_case
|
||||
args = None
|
||||
@@ -25,4 +26,11 @@ def reset():
|
||||
# TODO: to migrate to camel_case for v1.3 change this value to True
|
||||
camel_case = False
|
||||
|
||||
reset()
|
||||
# These assignments are used instead of calling reset()
|
||||
# purely to shut pylint up.
|
||||
args = None
|
||||
parser = None
|
||||
channel_index = None
|
||||
logfile = None
|
||||
tunnelInstance = None
|
||||
camel_case = False
|
||||
|
||||
@@ -21,11 +21,12 @@ def test_MeshInterface(capsys):
|
||||
"""Test that we can instantiate a MeshInterface"""
|
||||
iface = MeshInterface(noProto=True)
|
||||
|
||||
nodes = {
|
||||
"!9388f81c": {
|
||||
"num": 2475227164,
|
||||
NODE_ID = "!9388f81c"
|
||||
NODE_NUM = 2475227164
|
||||
node = {
|
||||
"num": NODE_NUM,
|
||||
"user": {
|
||||
"id": "!9388f81c",
|
||||
"id": NODE_ID,
|
||||
"longName": "Unknown f81c",
|
||||
"shortName": "?1C",
|
||||
"macaddr": "RBeTiPgc",
|
||||
@@ -34,10 +35,9 @@ def test_MeshInterface(capsys):
|
||||
"position": {},
|
||||
"lastHeard": 1640204888,
|
||||
}
|
||||
}
|
||||
|
||||
iface.nodesByNum = {2475227164: nodes["!9388f81c"]}
|
||||
iface.nodes = nodes
|
||||
iface.nodes = {NODE_ID: node}
|
||||
iface.nodesByNum = {NODE_NUM: node}
|
||||
|
||||
myInfo = MagicMock()
|
||||
iface.myInfo = myInfo
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
"""Meshtastic unit tests for tunnel.py"""
|
||||
from meshtastic import globals
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
@@ -7,6 +6,8 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from meshtastic import globals
|
||||
|
||||
from ..tcp_interface import TCPInterface
|
||||
from ..tunnel import Tunnel, onTunnelReceive
|
||||
|
||||
|
||||
Reference in New Issue
Block a user