Skip to content

Commit ad02ce1

Browse files
authored
Merge pull request #524 from ianmcorvidae/make-tests-happy
Fix up or comment out broken tests, to get CI (hopefully) happy
2 parents 09f8405 + daa5587 commit ad02ce1

9 files changed

Lines changed: 616 additions & 558 deletions

File tree

meshtastic/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ def onConnection(interface, topic=pub.AUTO_TOPIC): # called when we (re)connect
7171
from typing import *
7272

7373
import google.protobuf.json_format
74-
import serial
75-
import timeago
76-
from dotmap import DotMap
74+
import serial # type: ignore[import-untyped]
75+
import timeago # type: ignore[import-untyped]
76+
from dotmap import DotMap # type: ignore[import-untyped]
7777
from google.protobuf.json_format import MessageToJson
78-
from pubsub import pub
78+
from pubsub import pub # type: ignore[import-untyped]
7979
from tabulate import tabulate
8080

8181
from meshtastic import (
@@ -127,9 +127,9 @@ class KnownProtocol(NamedTuple):
127127
name: str
128128
# portnum: int, now a key
129129
# If set, will be called to prase as a protocol buffer
130-
protobufFactory: Callable = None
130+
protobufFactory: Optional[Callable] = None
131131
# If set, invoked as onReceive(interface, packet)
132-
onReceive: Callable = None
132+
onReceive: Optional[Callable] = None
133133

134134

135135
def _onTextReceive(iface, asDict):

meshtastic/__main__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def setPref(config, comp_name, valStr) -> bool:
160160
val = meshtastic.util.fromStr(valStr)
161161
logging.debug(f"valStr:{valStr} val:{val}")
162162

163-
if snake_name == "psk" and len(valStr) < 8:
164-
print(f"Warning: wifi.psk must be 8 or more characters.")
163+
if snake_name == "wifi_psk" and len(valStr) < 8:
164+
print(f"Warning: network.wifi_psk must be 8 or more characters.")
165165
return False
166166

167167
enumType = pref.enum_type
@@ -638,6 +638,11 @@ def onConnected(interface):
638638

639639
def setSimpleConfig(modem_preset):
640640
"""Set one of the simple modem_config"""
641+
channelIndex = our_globals.get_channel_index()
642+
if channelIndex is not None and channelIndex > 0:
643+
meshtastic.util.our_exit(
644+
"Warning: Cannot set modem preset for non-primary channel", 1
645+
)
641646
# Overwrite modem_preset
642647
prefs = interface.getNode(args.dest).localConfig
643648
prefs.lora.modem_preset = modem_preset

meshtastic/mesh_interface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def showInfo(self, file=sys.stdout): # pylint: disable=W0613
129129

130130
# use id as dictionary key for correct json format in list of nodes
131131
nodeid = n2["user"]["id"]
132-
n2["user"].pop("id")
133132
nodes[nodeid] = n2
134133
infos = owner + myinfo + metadata + mesh + json.dumps(nodes)
135134
print(infos)

0 commit comments

Comments
 (0)