Skip to content

Commit fc721f9

Browse files
Migrated TestBoardListallWithManuallyInstalledPlatform from test_board.py to board_test.go
1 parent ca0201e commit fc721f9

File tree

2 files changed

+49
-30
lines changed

2 files changed

+49
-30
lines changed

internal/integrationtest/board/board_test.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"github.com/arduino/arduino-cli/internal/integrationtest"
2323
"github.com/stretchr/testify/require"
2424
"go.bug.st/testifyjson/requirejson"
25+
"gopkg.in/src-d/go-git.v4"
26+
"gopkg.in/src-d/go-git.v4/plumbing"
2527
)
2628

2729
func TestBoardList(t *testing.T) {
@@ -108,3 +110,50 @@ func TestBoardListall(t *testing.T) {
108110
// Check if the boards' "latest" value is not empty
109111
requirejson.Query(t, stdout, ".boards | .[] | .platform | .latest != \"\"", "true")
110112
}
113+
114+
func TestBoardListallWithManuallyInstalledPlatform(t *testing.T) {
115+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
116+
defer env.CleanUp()
117+
118+
_, _, err := cli.Run("update")
119+
require.NoError(t, err)
120+
121+
// Manually installs a core in sketchbooks hardware folder
122+
gitUrl := "https://github.com/arduino/ArduinoCore-samd.git"
123+
repoDir := cli.SketchbookDir().Join("hardware", "arduino-beta-development", "samd")
124+
_, err = git.PlainClone(repoDir.String(), false, &git.CloneOptions{
125+
URL: gitUrl,
126+
ReferenceName: plumbing.NewTagReferenceName("1.8.11"),
127+
})
128+
require.NoError(t, err)
129+
130+
stdout, _, err := cli.Run("board", "listall", "--format", "json")
131+
require.NoError(t, err)
132+
133+
requirejson.Query(t, stdout, ".boards | length", "17")
134+
135+
requirejson.Contains(t, stdout, `{
136+
"boards": [
137+
{
138+
"name": "Arduino MKR1000",
139+
"fqbn": "arduino-beta-development:samd:mkr1000",
140+
"platform": {
141+
"id": "arduino-beta-development:samd",
142+
"installed": "1.8.11",
143+
"latest": "1.8.11",
144+
"name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
145+
}
146+
},
147+
{
148+
"name": "Arduino NANO 33 IoT",
149+
"fqbn": "arduino-beta-development:samd:nano_33_iot",
150+
"platform": {
151+
"id": "arduino-beta-development:samd",
152+
"installed": "1.8.11",
153+
"latest": "1.8.11",
154+
"name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards"
155+
}
156+
}
157+
]
158+
}`)
159+
}

test/test_board.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -394,36 +394,6 @@
394394
""" # noqa: E501
395395

396396

397-
def test_board_listall_with_manually_installed_platform(run_command, data_dir):
398-
assert run_command(["update"])
399-
400-
# Manually installs a core in sketchbooks hardware folder
401-
git_url = "https://github.com/arduino/ArduinoCore-samd.git"
402-
repo_dir = Path(data_dir, "hardware", "arduino-beta-development", "samd")
403-
assert Repo.clone_from(git_url, repo_dir, multi_options=["-b 1.8.11"])
404-
405-
res = run_command(["board", "listall", "--format", "json"])
406-
assert res.ok
407-
data = json.loads(res.stdout)
408-
boards = {b["fqbn"]: b for b in data["boards"]}
409-
assert len(boards) == 17
410-
assert "arduino-beta-development:samd:nano_33_iot" in boards
411-
assert "Arduino NANO 33 IoT" == boards["arduino-beta-development:samd:nano_33_iot"]["name"]
412-
platform = boards["arduino-beta-development:samd:nano_33_iot"]["platform"]
413-
assert "arduino-beta-development:samd" == platform["id"]
414-
assert "1.8.11" == platform["installed"]
415-
assert "1.8.11" == platform["latest"]
416-
assert "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" == platform["name"]
417-
418-
assert "arduino-beta-development:samd:mkr1000" in boards
419-
assert "Arduino MKR1000" == boards["arduino-beta-development:samd:mkr1000"]["name"]
420-
platform = boards["arduino-beta-development:samd:mkr1000"]["platform"]
421-
assert "arduino-beta-development:samd" == platform["id"]
422-
assert "1.8.11" == platform["installed"]
423-
assert "1.8.11" == platform["latest"]
424-
assert "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" == platform["name"]
425-
426-
427397
def test_board_details(run_command):
428398
run_command(["core", "update-index"])
429399
# Download samd core pinned to 1.8.6

0 commit comments

Comments
 (0)