Skip to content

Commit 15d7364

Browse files
Migrate TestCompileWithKnownPlatformNotInstalled from test_compile_part_4.py to compile_part_4_test.go
1 parent 64e21bc commit 15d7364

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

internal/integrationtest/compile/compile_part_4_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,23 @@ func TestCompileNonInstalledPlatformWithWrongPackagerAndArch(t *testing.T) {
448448
require.Contains(t, string(stderr), "Error during build: Platform 'arduino:wrong' not found: platform not installed")
449449
require.Contains(t, string(stderr), "Platform arduino:wrong is not found in any known index")
450450
}
451+
452+
func TestCompileWithKnownPlatformNotInstalled(t *testing.T) {
453+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
454+
defer env.CleanUp()
455+
456+
_, _, err := cli.Run("update")
457+
require.NoError(t, err)
458+
459+
// Create a sketch
460+
sketchPath := cli.SketchbookDir().Join("SketchSimple")
461+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
462+
require.NoError(t, err)
463+
464+
// Try to compile using a platform found in the index but not installed
465+
_, stderr, err := cli.Run("compile", "-b", "arduino:avr:uno", sketchPath.String())
466+
require.Error(t, err)
467+
require.Contains(t, string(stderr), "Error during build: Platform 'arduino:avr' not found: platform not installed")
468+
// Verifies command to fix error is shown to user
469+
require.Contains(t, string(stderr), "Try running `arduino-cli core install arduino:avr`")
470+
}

test/test_compile_part_4.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +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_with_known_platform_not_installed(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-
# Try to compile using a platform found in the index but not installed
95-
res = run_command(["compile", "-b", "arduino:avr:uno", sketch_path])
96-
assert res.failed
97-
assert "Error during build: Platform 'arduino:avr' not found: platform not installed" in res.stderr
98-
# Verifies command to fix error is shown to user
99-
assert "Try running `arduino-cli core install arduino:avr`" in res.stderr
100-
101-
10286
def test_compile_with_fake_secure_boot_core(run_command, data_dir):
10387
assert run_command(["update"])
10488

0 commit comments

Comments
 (0)