Skip to content

Commit 93fafe5

Browse files
Migrate TestCompileNonInstalledPlatformWithWrongPackagerAndArch from test_compile_part_4.py to compile_part_4_test.go
1 parent 93e3572 commit 93fafe5

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

internal/integrationtest/compile/compile_part_4_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,3 +423,28 @@ func TestCompileWithoutUploadAndFqbn(t *testing.T) {
423423
require.Error(t, err)
424424
require.Contains(t, string(stderr), "Missing FQBN (Fully Qualified Board Name)")
425425
}
426+
427+
func TestCompileNonInstalledPlatformWithWrongPackagerAndArch(t *testing.T) {
428+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
429+
defer env.CleanUp()
430+
431+
_, _, err := cli.Run("update")
432+
require.NoError(t, err)
433+
434+
// Create a sketch
435+
sketchPath := cli.SketchbookDir().Join("SketchSimple")
436+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
437+
require.NoError(t, err)
438+
439+
// Compile with wrong packager
440+
_, stderr, err := cli.Run("compile", "-b", "wrong:avr:uno", sketchPath.String())
441+
require.Error(t, err)
442+
require.Contains(t, string(stderr), "Error during build: Platform 'wrong:avr' not found: platform not installed")
443+
require.Contains(t, string(stderr), "Platform wrong:avr is not found in any known index")
444+
445+
// Compile with wrong arch
446+
_, stderr, err = cli.Run("compile", "-b", "arduino:wrong:uno", sketchPath.String())
447+
require.Error(t, err)
448+
require.Contains(t, string(stderr), "Error during build: Platform 'arduino:wrong' not found: platform not installed")
449+
require.Contains(t, string(stderr), "Platform arduino:wrong is not found in any known index")
450+
}

test/test_compile_part_4.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,6 @@ def test_compile_with_relative_build_path(run_command, data_dir, copy_sketch):
8383
assert "sketch" in built_files
8484

8585

86-
def test_compile_non_installed_platform_with_wrong_packager_and_arch(run_command, data_dir):
87-
assert run_command(["update"])
88-
89-
# Create a sketch
90-
sketch_name = "SketchSimple"
91-
sketch_path = Path(data_dir, sketch_name)
92-
assert run_command(["sketch", "new", sketch_path])
93-
94-
# Compile with wrong packager
95-
res = run_command(["compile", "-b", "wrong:avr:uno", sketch_path])
96-
assert res.failed
97-
assert "Error during build: Platform 'wrong:avr' not found: platform not installed" in res.stderr
98-
assert "Platform wrong:avr is not found in any known index" in res.stderr
99-
100-
# Compile with wrong arch
101-
res = run_command(["compile", "-b", "arduino:wrong:uno", sketch_path])
102-
assert res.failed
103-
assert "Error during build: Platform 'arduino:wrong' not found: platform not installed" in res.stderr
104-
assert "Platform arduino:wrong is not found in any known index" in res.stderr
105-
106-
10786
def test_compile_with_known_platform_not_installed(run_command, data_dir):
10887
assert run_command(["update"])
10988

0 commit comments

Comments
 (0)