Files
firmware/test/end2end/test.py

41 lines
1.2 KiB
Python
Raw Normal View History

2024-08-25 15:27:59 -05:00
import flash
2024-08-25 13:41:58 -05:00
import meshtastic
import meshtastic.serial_interface
2024-08-25 15:27:59 -05:00
import pytest
2024-08-25 13:41:58 -05:00
2024-08-25 15:27:59 -05:00
# from datetime import datetime
heltec_v3 = ["/dev/cu.usbserial-0001", "heltec-v3", "esp32"]
2024-08-25 13:41:58 -05:00
tbeam = ["COM18", "tbeam", "esp32"]
rak4631 = ["COM19", "rak4631", "nrf52"]
2024-08-25 15:27:59 -05:00
2024-08-25 13:41:58 -05:00
@pytest.fixture(scope="module", params=[heltec_v3])
def device(request):
port = request.param[0]
pio_env = request.param[1]
arch = request.param[2]
# Set up device
if arch == "esp32":
flash.flash_esp32(pio_env=pio_env, port=port)
elif arch == "nrf52":
flash.flash_nrf52(pio_env=pio_env, port=port)
# factory reset
yield meshtastic.serial_interface.SerialInterface(port)
2024-08-25 15:27:59 -05:00
# Tear down devices
2024-08-25 13:41:58 -05:00
# Test want_config responses from device
def test_get_info(device):
assert device is not None, "Expected port to be set"
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.moduleConfig is not None, "Expected ModuleConfig to be set"
2024-08-25 15:27:59 -05:00
assert (
len(device.localNode.channels) > 0
), "Expected at least one channel in the device"
2024-08-25 13:41:58 -05:00
if __name__ == "__main__":
2024-08-25 15:27:59 -05:00
pytest.main()