Skip to content

[skip-changelog]Migrate tests from upload_test.py to test_upload.go #2001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Migrate TestUploadToPortWithBoardAutodetect from test_upload.py to up…
…load_test.go
  • Loading branch information
MatteoPologruto committed Dec 13, 2022
commit a6d02eef336963499e4e22b0b7aebf5693916686
29 changes: 29 additions & 0 deletions internal/integrationtest/upload/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,32 @@ func TestUploadSketchWithMismatchedCasing(t *testing.T) {
require.Contains(t, string(stderr), "Error during Upload:")
}
}

func TestUploadToPortWithBoardAutodetect(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("VMs have no serial ports")
}

env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()

_, _, err := cli.Run("update")
require.NoError(t, err)

// Create a sketch
sketchPath := cli.SketchbookDir().Join("SketchSimple")
_, _, err = cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)

for _, board := range detectedBoards(t, cli) {
// Install core
_, _, err = cli.Run("core", "install", board.core)
require.NoError(t, err)

_, _, err = cli.Run("compile", "-b", board.fqbn, sketchPath.String())
require.NoError(t, err)

_, _, err = cli.Run("upload", "-p", board.address, sketchPath.String())
require.NoError(t, err)
}
}
19 changes: 0 additions & 19 deletions test/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@ def test_upload_after_attach(run_command, data_dir, detected_boards):
assert run_command(["upload", sketch_path])


def test_upload_to_port_with_board_autodetect(run_command, data_dir, detected_boards):
assert run_command(["update"])

# Create a sketch
sketch_name = "SketchSimple"
sketch_path = Path(data_dir, sketch_name)
assert run_command(["sketch", "new", sketch_path])

for board in detected_boards:
# Install core
core = ":".join(board.fqbn.split(":")[:2])
assert run_command(["core", "install", core])

assert run_command(["compile", "-b", board.fqbn, sketch_path])

res = run_command(["upload", "-p", board.address, sketch_path])
assert res.ok


def test_compile_and_upload_to_port_with_board_autodetect(run_command, data_dir, detected_boards):
assert run_command(["update"])

Expand Down