394394
395395@pytest .mark .skipif (running_on_ci (), reason = "VMs have no serial ports" )
396396def test_board_list (run_command ):
397- run_command ("core update-index" )
398- result = run_command ("board list --format json" )
397+ run_command ([ "core" , " update-index"] )
398+ result = run_command ([ "board" , " list" , " --format" , " json"] )
399399 assert result .ok
400400 # check is a valid json and contains a list of ports
401401 ports = json .loads (result .stdout )
@@ -406,9 +406,9 @@ def test_board_list(run_command):
406406
407407
408408def test_board_listall (run_command ):
409- assert run_command ("update" )
410- assert run_command ("core install arduino:avr@1.8.3" )
411- res = run_command ("board listall --format json" )
409+ assert run_command ([ "update" ] )
410+ assert run_command ([ "core" , " install" , " arduino:avr@1.8.3"] )
411+ res = run_command ([ "board" , " listall" , " --format" , " json"] )
412412 assert res .ok
413413 data = json .loads (res .stdout )
414414 boards = {b ["fqbn" ]: b for b in data ["boards" ]}
@@ -431,14 +431,14 @@ def test_board_listall(run_command):
431431
432432
433433def test_board_listall_with_manually_installed_platform (run_command , data_dir ):
434- assert run_command ("update" )
434+ assert run_command ([ "update" ] )
435435
436436 # Manually installs a core in sketchbooks hardware folder
437437 git_url = "https://github.com/arduino/ArduinoCore-samd.git"
438438 repo_dir = Path (data_dir , "hardware" , "arduino-beta-development" , "samd" )
439439 assert Repo .clone_from (git_url , repo_dir , multi_options = ["-b 1.8.11" ])
440440
441- res = run_command ("board listall --format json" )
441+ res = run_command ([ "board" , " listall" , " --format" , " json"] )
442442 assert res .ok
443443 data = json .loads (res .stdout )
444444 boards = {b ["fqbn" ]: b for b in data ["boards" ]}
@@ -461,21 +461,21 @@ def test_board_listall_with_manually_installed_platform(run_command, data_dir):
461461
462462
463463def test_board_details (run_command ):
464- run_command ("core update-index" )
464+ run_command ([ "core" , " update-index"] )
465465 # Download samd core pinned to 1.8.6
466- run_command ("core install arduino:samd@1.8.6" )
466+ run_command ([ "core" , " install" , " arduino:samd@1.8.6"] )
467467
468468 # Test board listall with and without showing hidden elements
469- result = run_command ("board listall MIPS --format json" )
469+ result = run_command ([ "board" , " listall" , " MIPS" , " --format" , " json"] )
470470 assert result .ok
471471 assert result .stdout == "{}\n "
472472
473- result = run_command ("board listall MIPS -a --format json" )
473+ result = run_command ([ "board" , " listall" , " MIPS" , "-a" , " --format" , " json"] )
474474 assert result .ok
475475 result = json .loads (result .stdout )
476476 assert result ["boards" ][0 ]["name" ] == "Arduino Tian (MIPS Console port)"
477477
478- result = run_command ("board details -b arduino:samd:nano_33_iot --format json" )
478+ result = run_command ([ "board" , " details" , "-b" , " arduino:samd:nano_33_iot" , " --format" , " json"] )
479479 assert result .ok
480480 # Sort everything before compare
481481 result = json .loads (result .stdout )
@@ -494,20 +494,20 @@ def test_board_details(run_command):
494494 assert programmer in result ["programmers" ]
495495
496496 # Download samd core pinned to 1.8.8
497- run_command ("core install arduino:samd@1.8.8" )
497+ run_command ([ "core" , " install" , " arduino:samd@1.8.8"] )
498498
499- result = run_command ("board details -b arduino:samd:nano_33_iot --format json" )
499+ result = run_command ([ "board" , " details" , "-b" , " arduino:samd:nano_33_iot" , " --format" , " json"] )
500500 assert result .ok
501501 result = json .loads (result .stdout )
502502 assert result ["debugging_supported" ] is True
503503
504504
505505# old `arduino-cli board details` did not need -b <fqbn> flag to work
506506def test_board_details_old (run_command ):
507- run_command ("core update-index" )
507+ run_command ([ "core" , " update-index"] )
508508 # Download samd core pinned to 1.8.6
509- run_command ("core install arduino:samd@1.8.6" )
510- result = run_command ("board details arduino:samd:nano_33_iot --format json" )
509+ run_command ([ "core" , " install" , " arduino:samd@1.8.6"] )
510+ result = run_command ([ "board" , " details" , " arduino:samd:nano_33_iot" , " --format" , " json"] )
511511 assert result .ok
512512 # Sort everything before compare
513513 result = json .loads (result .stdout )
@@ -527,20 +527,20 @@ def test_board_details_old(run_command):
527527
528528
529529def test_board_details_no_flags (run_command ):
530- run_command ("core update-index" )
530+ run_command ([ "core" , " update-index"] )
531531 # Download samd core pinned to 1.8.6
532- run_command ("core install arduino:samd@1.8.6" )
533- result = run_command ("board details" )
532+ run_command ([ "core" , " install" , " arduino:samd@1.8.6"] )
533+ result = run_command ([ "board" , " details"] )
534534 assert not result .ok
535535 assert "Error getting board details: Invalid FQBN:" in result .stderr
536536 assert result .stdout == ""
537537
538538
539539def test_board_details_list_programmers_without_flag (run_command ):
540- run_command ("core update-index" )
540+ run_command ([ "core" , " update-index"] )
541541 # Download samd core pinned to 1.8.6
542- run_command ("core install arduino:samd@1.8.6" )
543- result = run_command ("board details -b arduino:samd:nano_33_iot" )
542+ run_command ([ "core" , " install" , " arduino:samd@1.8.6"] )
543+ result = run_command ([ "board" , " details" , "-b" , " arduino:samd:nano_33_iot"] )
544544 assert result .ok
545545 lines = [l .strip ().split () for l in result .stdout .splitlines ()]
546546 assert ["Programmers:" , "Id" , "Name" ] in lines
@@ -550,10 +550,10 @@ def test_board_details_list_programmers_without_flag(run_command):
550550
551551
552552def test_board_details_list_programmers_flag (run_command ):
553- run_command ("core update-index" )
553+ run_command ([ "core" , " update-index"] )
554554 # Download samd core pinned to 1.8.6
555- run_command ("core install arduino:samd@1.8.6" )
556- result = run_command ("board details -b arduino:samd:nano_33_iot --list-programmers" )
555+ run_command ([ "core" , " install" , " arduino:samd@1.8.6"] )
556+ result = run_command ([ "board" , " details" , "-b" , " arduino:samd:nano_33_iot" , " --list-programmers"] )
557557 assert result .ok
558558
559559 lines = [l .strip () for l in result .stdout .splitlines ()]
@@ -564,9 +564,9 @@ def test_board_details_list_programmers_flag(run_command):
564564
565565
566566def test_board_search (run_command , data_dir ):
567- assert run_command ("update" )
567+ assert run_command ([ "update" ] )
568568
569- res = run_command ("board search --format json" )
569+ res = run_command ([ "board" , " search" , " --format" , " json"] )
570570 assert res .ok
571571 data = json .loads (res .stdout )
572572 # Verifies boards are returned
@@ -581,7 +581,7 @@ def test_board_search(run_command, data_dir):
581581 assert "Arduino Portenta H7" in names
582582
583583 # Search in non installed boards
584- res = run_command ("board search --format json nano 33" )
584+ res = run_command ([ "board" , " search" , " --format" , " json" , " nano" , " 33"] )
585585 assert res .ok
586586 data = json .loads (res .stdout )
587587 # Verifies boards are returned
@@ -593,9 +593,9 @@ def test_board_search(run_command, data_dir):
593593 assert "Arduino Nano 33 IoT" in names
594594
595595 # Install a platform from index
596- assert run_command ("core install arduino:avr@1.8.3" )
596+ assert run_command ([ "core" , " install" , " arduino:avr@1.8.3"] )
597597
598- res = run_command ("board search --format json" )
598+ res = run_command ([ "board" , " search" , " --format" , " json"] )
599599 assert res .ok
600600 data = json .loads (res .stdout )
601601 assert len (data ) > 0
@@ -607,7 +607,7 @@ def test_board_search(run_command, data_dir):
607607 assert "arduino:avr:yun" in installed_boards
608608 assert "Arduino Yún" == installed_boards ["arduino:avr:yun" ]["name" ]
609609
610- res = run_command ("board search --format json arduino yun" )
610+ res = run_command ([ "board" , " search" , " --format" , " json" , " arduino" , " yun"] )
611611 assert res .ok
612612 data = json .loads (res .stdout )
613613 assert len (data ) > 0
@@ -620,7 +620,7 @@ def test_board_search(run_command, data_dir):
620620 repo_dir = Path (data_dir , "hardware" , "arduino-beta-development" , "samd" )
621621 assert Repo .clone_from (git_url , repo_dir , multi_options = ["-b 1.8.11" ])
622622
623- res = run_command ("board search --format json" )
623+ res = run_command ([ "board" , " search" , " --format" , " json"] )
624624 assert res .ok
625625 data = json .loads (res .stdout )
626626 assert len (data ) > 0
@@ -641,7 +641,7 @@ def test_board_search(run_command, data_dir):
641641 assert "Arduino NANO 33 IoT" == installed_boards ["arduino-beta-development:samd:nano_33_iot" ]["name" ]
642642 assert "arduino-beta-development:samd:arduino_zero_native" in installed_boards
643643
644- res = run_command ("board search --format json mkr1000" )
644+ res = run_command ([ "board" , " search" , " --format" , " json" , " mkr1000"] )
645645 assert res .ok
646646 data = json .loads (res .stdout )
647647 assert len (data ) > 0
@@ -652,25 +652,25 @@ def test_board_search(run_command, data_dir):
652652
653653
654654def test_board_attach_without_sketch_json (run_command , data_dir ):
655- run_command ("update" )
655+ run_command ([ "update" ] )
656656
657657 sketch_name = "BoardAttachWithoutSketchJson"
658658 sketch_path = Path (data_dir , sketch_name )
659659 fqbn = "arduino:avr:uno"
660660
661661 # Create a test sketch
662- assert run_command (f "sketch new { sketch_path } " )
662+ assert run_command ([ "sketch" , " new" , sketch_path ] )
663663
664- assert run_command (f "board attach { fqbn } { sketch_path } " )
664+ assert run_command ([ "board" , " attach" , fqbn , sketch_path ] )
665665
666666
667667def test_board_search_with_outdated_core (run_command ):
668- assert run_command ("update" )
668+ assert run_command ([ "update" ] )
669669
670670 # Install an old core version
671- assert run_command ("core install arduino:samd@1.8.6" )
671+ assert run_command ([ "core" , " install" , " arduino:samd@1.8.6"] )
672672
673- res = run_command ("board search arduino:samd:mkrwifi1010 --format json" )
673+ res = run_command ([ "board" , " search" , " arduino:samd:mkrwifi1010" , " --format" , " json"] )
674674
675675 data = json .loads (res .stdout )
676676 assert len (data ) == 1
0 commit comments