forked from arduino/arduino-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression: do not crash on
board list
if a discovery is not pr…
…operly installed (arduino#1814) * Added tests for arduino#1669 * Fixed regession in discoveries startup Fix arduino#1669
- Loading branch information
Showing
2 changed files
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
# a commercial license, send an email to [email protected]. | ||
from pathlib import Path | ||
from git import Repo | ||
import os | ||
import glob | ||
import simplejson as json | ||
import semver | ||
import pytest | ||
|
@@ -405,6 +407,23 @@ def test_board_list(run_command): | |
assert "protocol_label" in port["port"] | ||
|
||
|
||
def test_board_list_with_invalid_discovery(run_command, data_dir): | ||
run_command(["core", "update-index"]) | ||
result = run_command(["board", "list"]) | ||
assert result.ok | ||
|
||
# check that the CLI do no crash if an invalid discovery is installed | ||
# (for example if the installation fails midway). | ||
# https://github.com/arduino/arduino-cli/issues/1669 | ||
tool_dir = os.path.join(data_dir, "packages", "builtin", "tools", "serial-discovery") | ||
for file_to_delete in glob.glob(tool_dir + "/*/*"): | ||
os.remove(file_to_delete) | ||
|
||
result = run_command(["board", "list"]) | ||
assert result.ok | ||
assert "builtin:serial-discovery" in result.stderr | ||
|
||
|
||
def test_board_listall(run_command): | ||
assert run_command(["update"]) | ||
assert run_command(["core", "install", "arduino:[email protected]"]) | ||
|