mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-10 23:22:05 +00:00
wip
This commit is contained in:
parent
15ee827efd
commit
36cadd03ee
@ -1,6 +1,9 @@
|
|||||||
import usb.core
|
# trunk-ignore-all(bandit/B404)
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
import usb.core
|
||||||
|
|
||||||
|
|
||||||
def find_usb_device(vendor_id, product_id):
|
def find_usb_device(vendor_id, product_id):
|
||||||
# Find USB devices
|
# Find USB devices
|
||||||
dev = usb.core.find(find_all=True)
|
dev = usb.core.find(find_all=True)
|
||||||
@ -10,11 +13,21 @@ def find_usb_device(vendor_id, product_id):
|
|||||||
return cfg
|
return cfg
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
# Flash esp32 target
|
# Flash esp32 target
|
||||||
def flash_esp32(pio_env, port):
|
def flash_esp32(pio_env, port):
|
||||||
# Flash the ESP32 target
|
# Flash the ESP32 target
|
||||||
subprocess.run(["platformio", "run", "-e", pio_env, "-t", "upload", "-p", port])
|
# trunk-ignore(bandit/B603)
|
||||||
|
# trunk-ignore(bandit/B607)
|
||||||
|
subprocess.run(
|
||||||
|
["platformio", "run", "-e", pio_env, "-t", "upload", "--upload-port", port]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def flash_nrf52(pio_env, port):
|
def flash_nrf52(pio_env, port):
|
||||||
# Flash the nrf52 target
|
# Flash the nrf52 target
|
||||||
subprocess.run(["platformio", "run", "-e", pio_env, "-t", "upload", "-p", port])
|
# trunk-ignore(bandit/B603)
|
||||||
|
# trunk-ignore(bandit/B607)
|
||||||
|
subprocess.run(
|
||||||
|
["platformio", "run", "-e", pio_env, "-t", "upload", "--upload-port", port]
|
||||||
|
)
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import sys
|
import flash
|
||||||
|
|
||||||
import pytest
|
|
||||||
import meshtastic
|
import meshtastic
|
||||||
import meshtastic.serial_interface
|
import meshtastic.serial_interface
|
||||||
from datetime import datetime
|
import pytest
|
||||||
import flash
|
|
||||||
|
|
||||||
heltec_v3 = ["COM17", "heltec-v3", "esp32"]
|
# from datetime import datetime
|
||||||
|
|
||||||
|
heltec_v3 = ["/dev/cu.usbserial-0001", "heltec-v3", "esp32"]
|
||||||
tbeam = ["COM18", "tbeam", "esp32"]
|
tbeam = ["COM18", "tbeam", "esp32"]
|
||||||
rak4631 = ["COM19", "rak4631", "nrf52"]
|
rak4631 = ["COM19", "rak4631", "nrf52"]
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module", params=[heltec_v3])
|
@pytest.fixture(scope="module", params=[heltec_v3])
|
||||||
def device(request):
|
def device(request):
|
||||||
port = request.param[0]
|
port = request.param[0]
|
||||||
@ -22,7 +22,8 @@ def device(request):
|
|||||||
flash.flash_nrf52(pio_env=pio_env, port=port)
|
flash.flash_nrf52(pio_env=pio_env, port=port)
|
||||||
# factory reset
|
# factory reset
|
||||||
yield meshtastic.serial_interface.SerialInterface(port)
|
yield meshtastic.serial_interface.SerialInterface(port)
|
||||||
# Tear down device
|
# Tear down devices
|
||||||
|
|
||||||
|
|
||||||
# Test want_config responses from device
|
# Test want_config responses from device
|
||||||
def test_get_info(device):
|
def test_get_info(device):
|
||||||
@ -30,7 +31,10 @@ def test_get_info(device):
|
|||||||
assert len(device.nodes) > 0, "Expected at least one node in the device NodeDB"
|
assert len(device.nodes) > 0, "Expected at least one node in the device NodeDB"
|
||||||
assert device.localNode.localConfig is not None, "Expected LocalConfig to be set"
|
assert device.localNode.localConfig is not None, "Expected LocalConfig to be set"
|
||||||
assert device.localNode.moduleConfig is not None, "Expected ModuleConfig to be set"
|
assert device.localNode.moduleConfig is not None, "Expected ModuleConfig to be set"
|
||||||
assert len(device.localNode.channels) > 0, "Expected at least one channel in the device"
|
assert (
|
||||||
|
len(device.localNode.channels) > 0
|
||||||
|
), "Expected at least one channel in the device"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pytest.main()
|
pytest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user