Skip to content
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 TestUploadWithInputDirFlag from test_upload.py to upload_test.go
  • Loading branch information
MatteoPologruto committed Dec 13, 2022
commit 9f5f3de571e85d66635cb26c408740e3758a14ed
36 changes: 36 additions & 0 deletions internal/integrationtest/upload/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,39 @@ func TestUpload(t *testing.T) {
require.NoError(t, err)
}
}

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

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

// Init the environment explicitly
_, _, err := cli.Run("core", "update-index")
require.NoError(t, err)

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

// Create a sketch
sketchName := "TestUploadSketch" + board.id
sketchPath := cli.SketchbookDir().Join(sketchName)
fqbn := board.fqbn
address := board.address
_, _, err = cli.Run("sketch", "new", sketchPath.String())
require.NoError(t, err)

// Build sketch and export binaries to custom directory
outputDir := cli.SketchbookDir().Join("test_dir", sketchName, "build")
_, _, err = cli.Run("compile", "-b", fqbn, sketchPath.String(), "--output-dir", outputDir.String())
require.NoError(t, err)

// Upload with --input-dir flag
_, _, err = cli.Run("upload", "-b", fqbn, "-p", address, "--input-dir", outputDir.String())
require.NoError(t, err)
}
}
23 changes: 0 additions & 23 deletions test/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,6 @@
pytestmark = pytest.mark.skipif(running_on_ci(), reason="VMs have no serial ports")


def test_upload_with_input_dir_flag(run_command, data_dir, detected_boards):
# Init the environment explicitly
run_command(["core", "update-index"])

for board in detected_boards:
# Download board platform
run_command(["core", "install", board.core])

# Create sketch
sketch_name = f"TestUploadInputDirSketch{board.id}"
sketch_path = Path(data_dir, sketch_name)
fqbn = board.fqbn
address = board.address
assert run_command(["sketch", "new", sketch_path])

# Build sketch and export binaries to custom directory
output_dir = Path(data_dir, "test_dir", sketch_name, "build")
assert run_command(["compile", "-b", fqbn, sketch_path, "--output-dir", output_dir])

# Upload with --input-dir flag
assert run_command(["upload", "-b", fqbn, "-p", address, "--input-dir", output_dir])


def test_upload_with_input_file_flag(run_command, data_dir, detected_boards):
# Init the environment explicitly
run_command(["core", "update-index"])
Expand Down