Skip to content

Commit 8483cb2

Browse files
author
Roberto Sora
authored
Remove upload port as required CLI parameter in "upload" command (arduino#608)
* Remove upload port as required CLI parameter in "upload" command * Add "board attach" integ test
1 parent 024b8f3 commit 8483cb2

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Diff for: cli/upload/upload.go

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ func NewCommand() *cobra.Command {
5454
uploadCommand.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.")
5555
uploadCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "Optional, turns on verbose mode.")
5656

57-
uploadCommand.MarkFlagRequired("port")
58-
5957
return uploadCommand
6058
}
6159

Diff for: test/test_upload.py

+26
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,35 @@ def test_upload(run_command, data_dir, detected_boards):
3838
fqbn=board.fqbn, sketch_path=sketch_path
3939
)
4040
)
41+
# Upload without port must fail
42+
result = run_command(
43+
"upload -b {fqbn} {sketch_path}".format(
44+
sketch_path=sketch_path, fqbn=board.fqbn, port=board.address
45+
)
46+
)
47+
assert result.failed
4148
# Upload
4249
assert run_command(
4350
"upload -b {fqbn} -p {port} {sketch_path}".format(
4451
sketch_path=sketch_path, fqbn=board.fqbn, port=board.address
4552
)
4653
)
54+
55+
56+
def test_upload_after_attach(run_command, data_dir, detected_boards):
57+
# Init the environment explicitly
58+
assert run_command("core update-index")
59+
60+
for board in detected_boards:
61+
# Download core
62+
assert run_command("core install {}".format(board.core))
63+
# Create a sketch
64+
sketch_path = os.path.join(data_dir, "foo")
65+
assert run_command("sketch new {}".format(sketch_path))
66+
assert run_command(
67+
"board attach serial://{port} {sketch_path}".format(port=board.address, sketch_path=sketch_path)
68+
)
69+
# Build sketch
70+
assert run_command("compile {sketch_path}".format(sketch_path=sketch_path))
71+
# Upload
72+
assert run_command("upload {sketch_path}".format(sketch_path=sketch_path))

0 commit comments

Comments
 (0)