Skip to content

Commit

Permalink
test_build() and test_build_board(): documented. Lint passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 20, 2024
1 parent 83afa1f commit 3d3f214
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ lint: ## Lint and static-check
lint-test: ### Lint test scripts
python -m pylint test/conftest.py
python -m pylint test/test_apio.py
python -m pylint test/code_commands/test_build.py

test-one: ## Execute a test script
pytest -v -s test/test_apio.py
pytest -v -s test/code_commands/test_build.py::test_build_board

tox: ## Run tox
python -m tox
Expand Down
19 changes: 12 additions & 7 deletions test/code_commands/test_build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Test for the "apio build" command
"""

#-- This is for testing "apio build"
from apio.commands.build import cli as cmd_build

Expand All @@ -12,8 +16,9 @@ def test_build(clirunner, configenv):
"""

with clirunner.isolated_filesystem():

#-- Config the environment (conftest.configenv())
configenv()
print("\n (TESTING apio build) ", end='')

#-- Execute "apio build"
result = clirunner.invoke(cmd_build)
Expand All @@ -23,8 +28,8 @@ def test_build(clirunner, configenv):

#-- 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
assert 'Error: insufficient arguments: missing board' in result.output
assert 'Error: Missing FPGA' in result.output


def test_build_board(clirunner, configenv):
Expand All @@ -33,20 +38,20 @@ def test_build_board(clirunner, configenv):
"""

with clirunner.isolated_filesystem():

#-- Config the environment (conftest.configenv())
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
#-- 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
pass
assert 'install oss-cad-suite' in result.output


def test_build_complete(clirunner, configenv):
Expand Down

0 comments on commit 3d3f214

Please sign in to comment.