From 3d3f214f9d3422ad834057e878c8ae53332b8740 Mon Sep 17 00:00:00 2001 From: Obijuan Date: Tue, 20 Feb 2024 21:56:24 +0100 Subject: [PATCH] test_build() and test_build_board(): documented. Lint passed --- Makefile | 3 ++- test/code_commands/test_build.py | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index ef09a157..06494ade 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/test/code_commands/test_build.py b/test/code_commands/test_build.py index 20f4ee62..c6798631 100644 --- a/test/code_commands/test_build.py +++ b/test/code_commands/test_build.py @@ -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 @@ -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) @@ -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): @@ -33,8 +38,9 @@ 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']) @@ -42,11 +48,10 @@ def test_build_board(clirunner, configenv): #-- 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):