Skip to content

Commit b13ed89

Browse files
Migrate TestCompileAndUploadComboSketchWithMismatchedCasing from test_upload.py to upload_test.go
1 parent a84b98c commit b13ed89

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

internal/integrationtest/upload/upload_test.go

+32
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,35 @@ func TestUploadWithInputDirContainingMultipleBinaries(t *testing.T) {
460460
require.NoError(t, err)
461461
}
462462
}
463+
464+
func TestCompileAndUploadComboSketchWithMismatchedCasing(t *testing.T) {
465+
if os.Getenv("CI") != "" {
466+
t.Skip("VMs have no serial ports")
467+
}
468+
469+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
470+
defer env.CleanUp()
471+
472+
_, _, err := cli.Run("update")
473+
require.NoError(t, err)
474+
475+
// Create a sketch
476+
sketchName := "CompileUploadComboMismatchCasing"
477+
sketchPath := cli.SketchbookDir().Join(sketchName)
478+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
479+
require.NoError(t, err)
480+
481+
// Rename main .ino file so casing is different from sketch name
482+
require.NoError(t, sketchPath.Join(sketchName+".ino").Rename(sketchPath.Join(strings.ToLower(sketchName)+".ino")))
483+
484+
for _, board := range detectedBoards(t, cli) {
485+
// Install core
486+
_, _, err = cli.Run("core", "install", board.core)
487+
require.NoError(t, err)
488+
489+
// Try to compile
490+
_, stderr, err := cli.Run("compile", "--clean", "-b", board.fqbn, "-u", "-p", board.address, sketchPath.String())
491+
require.Error(t, err)
492+
require.Contains(t, string(stderr), "Error opening sketch:")
493+
}
494+
}

test/test_upload.py

-22
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,6 @@ def test_upload_after_attach(run_command, data_dir, detected_boards):
4242
assert run_command(["upload", sketch_path])
4343

4444

45-
def test_compile_and_upload_combo_sketch_with_mismatched_casing(run_command, data_dir, detected_boards, wait_for_board):
46-
assert run_command(["update"])
47-
48-
# Create a sketch
49-
sketch_name = "CompileUploadComboMismatchCasing"
50-
sketch_path = Path(data_dir, sketch_name)
51-
assert run_command(["sketch", "new", sketch_path])
52-
53-
# Rename main .ino file so casing is different from sketch name
54-
Path(sketch_path, f"{sketch_name}.ino").rename(sketch_path / f"{sketch_name.lower()}.ino")
55-
56-
for board in detected_boards:
57-
# Install core
58-
core = ":".join(board.fqbn.split(":")[:2])
59-
assert run_command(["core", "install", core])
60-
61-
# Try to compile
62-
res = run_command(["compile", "--clean", "-b", board.fqbn, "-u", "-p", board.address, sketch_path])
63-
assert res.failed
64-
assert "Error opening sketch:" in res.stderr
65-
66-
6745
def test_upload_sketch_with_mismatched_casing(run_command, data_dir, detected_boards, wait_for_board):
6846
assert run_command(["update"])
6947

0 commit comments

Comments
 (0)