Skip to content

Commit 1c05d52

Browse files
Migrate TestCoreListPlatformWithoutPlatformTxt from test_core.py to core_test.go
1 parent 6afbd7f commit 1c05d52

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

internal/integrationtest/core/core_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,3 +765,29 @@ func TestCoreListDeprecatedPlatformWithInstalledJson(t *testing.T) {
765765
requirejson.Len(t, stdout, 1)
766766
requirejson.Query(t, stdout, ".[] | .deprecated", "true")
767767
}
768+
769+
func TestCoreListPlatformWithoutPlatformTxt(t *testing.T) {
770+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
771+
defer env.CleanUp()
772+
773+
_, _, err := cli.Run("update")
774+
require.NoError(t, err)
775+
776+
stdout, _, err := cli.Run("core", "list", "--format", "json")
777+
require.NoError(t, err)
778+
requirejson.Len(t, stdout, 0)
779+
780+
// Simulates creation of a new core in the sketchbook hardware folder
781+
// without a platforms.txt
782+
testBoardsTxt := paths.New("..", "testdata", "boards.local.txt")
783+
boardsTxt := cli.SketchbookDir().Join("hardware", "some-packager", "some-arch", "boards.txt")
784+
require.NoError(t, boardsTxt.Parent().MkdirAll())
785+
require.NoError(t, testBoardsTxt.CopyTo(boardsTxt))
786+
787+
// Verifies no core is installed
788+
stdout, _, err = cli.Run("core", "list", "--format", "json")
789+
require.NoError(t, err)
790+
requirejson.Len(t, stdout, 1)
791+
requirejson.Query(t, stdout, ".[] | .id", "\"some-packager:some-arch\"")
792+
requirejson.Query(t, stdout, ".[] | .name", "\"some-packager-some-arch\"")
793+
}

test/test_core.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,33 +93,6 @@ def test_core_search_update_index_delay(run_command, data_dir):
9393
assert "Downloading index" not in res.stdout
9494

9595

96-
def test_core_list_platform_without_platform_txt(run_command, data_dir):
97-
assert run_command(["update"])
98-
99-
# Verifies no core is installed
100-
res = run_command(["core", "list", "--format", "json"])
101-
assert res.ok
102-
cores = json.loads(res.stdout)
103-
assert len(cores) == 0
104-
105-
# Simulates creation of a new core in the sketchbook hardware folder
106-
# without a platforms.txt
107-
test_boards_txt = Path(__file__).parent / "testdata" / "boards.local.txt"
108-
boards_txt = Path(data_dir, "hardware", "some-packager", "some-arch", "boards.txt")
109-
boards_txt.parent.mkdir(parents=True, exist_ok=True)
110-
boards_txt.touch()
111-
boards_txt.write_bytes(test_boards_txt.read_bytes())
112-
113-
# Verifies no core is installed
114-
res = run_command(["core", "list", "--format", "json"])
115-
assert res.ok
116-
cores = json.loads(res.stdout)
117-
assert len(cores) == 1
118-
core = cores[0]
119-
assert core["id"] == "some-packager:some-arch"
120-
assert core["name"] == "some-packager-some-arch"
121-
122-
12396
@pytest.mark.skipif(
12497
platform.system() in ["Darwin", "Windows"],
12598
reason="macOS by default is case insensitive https://github.com/actions/virtual-environments/issues/865 "

0 commit comments

Comments
 (0)