Skip to content

Commit

Permalink
test_build: add comments for better understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 12, 2024
1 parent 4e29935 commit 67da020
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/code_commands/test_build.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
#-- This is for testing "apio build"
from apio.commands.build import cli as cmd_build

#-- This is for testing "apio init"
from apio.commands.init import cli as cmd_init


def test_build(clirunner, configenv):
"""Test: apio build
when no apio.ini file is given
No additional parameters are given
"""

with clirunner.isolated_filesystem():
configenv()
print("\n (TESTING apio build) ", end='')

#-- Execute "apio build"
result = clirunner.invoke(cmd_build)

#-- It is an error. Exit code should not be 0
assert result.exit_code != 0

#-- Messages thtat should appear
assert 'Info: No apio.ini file' in result.output
assert 'Error: insufficient arguments: missing board' in result.output
assert 'Error: Missing board' in result.output


def test_build_board(clirunner, configenv):
"""Test: apio build --board icezum
No oss-cad-suite package is installed
"""

with clirunner.isolated_filesystem():
configenv()
print("\n (TESTING apio build --board icezum) ", end='')

#-- Execute "apio build --board icezum"
result = clirunner.invoke(cmd_build, ['--board', 'icezum'])

#-- It is an error. Exit code should not be 0
assert result.exit_code != 0

#-- Error code 1 means the install oss-cad-suite package
#-- is not installed
if result.exit_code == 1:
assert 'install oss-cad-suite' in result.output

Expand Down

0 comments on commit 67da020

Please sign in to comment.