mirror of
https://github.com/meshtastic/python.git
synced 2026-07-31 09:06:28 -04:00
Fail earlier if the ota update file isn't found
This commit is contained in:
@@ -1383,6 +1383,11 @@ def common():
|
||||
if not stripped_ham_name:
|
||||
meshtastic.util.our_exit("ERROR: Ham radio callsign cannot be empty or contain only whitespace characters")
|
||||
|
||||
# Early validation for OTA firmware file before attempting device connection
|
||||
if hasattr(args, 'ota_update') and args.ota_update is not None:
|
||||
if not os.path.isfile(args.ota_update):
|
||||
meshtastic.util.our_exit(f"Error: OTA firmware file not found: {args.ota_update}", 1)
|
||||
|
||||
if have_powermon:
|
||||
create_power_meter()
|
||||
|
||||
|
||||
@@ -3157,6 +3157,9 @@ def test_main_ota_update_file_not_found(capsys):
|
||||
|
||||
assert pytest_wrapped_e.type == SystemExit
|
||||
assert pytest_wrapped_e.value.code == 1
|
||||
out, err = capsys.readouterr()
|
||||
assert "OTA firmware file not found" in out
|
||||
assert "/nonexistent/firmware.bin" in out
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
|
||||
Reference in New Issue
Block a user