Skip to content

Commit a6d02ee

Browse files
Migrate TestUploadToPortWithBoardAutodetect from test_upload.py to upload_test.go
1 parent 18a4039 commit a6d02ee

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

internal/integrationtest/upload/upload_test.go

+29
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,32 @@ func TestUploadSketchWithMismatchedCasing(t *testing.T) {
525525
require.Contains(t, string(stderr), "Error during Upload:")
526526
}
527527
}
528+
529+
func TestUploadToPortWithBoardAutodetect(t *testing.T) {
530+
if os.Getenv("CI") != "" {
531+
t.Skip("VMs have no serial ports")
532+
}
533+
534+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
535+
defer env.CleanUp()
536+
537+
_, _, err := cli.Run("update")
538+
require.NoError(t, err)
539+
540+
// Create a sketch
541+
sketchPath := cli.SketchbookDir().Join("SketchSimple")
542+
_, _, err = cli.Run("sketch", "new", sketchPath.String())
543+
require.NoError(t, err)
544+
545+
for _, board := range detectedBoards(t, cli) {
546+
// Install core
547+
_, _, err = cli.Run("core", "install", board.core)
548+
require.NoError(t, err)
549+
550+
_, _, err = cli.Run("compile", "-b", board.fqbn, sketchPath.String())
551+
require.NoError(t, err)
552+
553+
_, _, err = cli.Run("upload", "-p", board.address, sketchPath.String())
554+
require.NoError(t, err)
555+
}
556+
}

test/test_upload.py

-19
Original file line numberDiff line numberDiff line change
@@ -42,25 +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_upload_to_port_with_board_autodetect(run_command, data_dir, detected_boards):
46-
assert run_command(["update"])
47-
48-
# Create a sketch
49-
sketch_name = "SketchSimple"
50-
sketch_path = Path(data_dir, sketch_name)
51-
assert run_command(["sketch", "new", sketch_path])
52-
53-
for board in detected_boards:
54-
# Install core
55-
core = ":".join(board.fqbn.split(":")[:2])
56-
assert run_command(["core", "install", core])
57-
58-
assert run_command(["compile", "-b", board.fqbn, sketch_path])
59-
60-
res = run_command(["upload", "-p", board.address, sketch_path])
61-
assert res.ok
62-
63-
6445
def test_compile_and_upload_to_port_with_board_autodetect(run_command, data_dir, detected_boards):
6546
assert run_command(["update"])
6647

0 commit comments

Comments
 (0)