From 80cd68ccf3defc399918352bc381eb557c619027 Mon Sep 17 00:00:00 2001 From: Obijuan Date: Sat, 24 Feb 2024 20:26:43 +0100 Subject: [PATCH] refactor test_sim.py and test_test.py --- test/code_commands/test_build.py | 2 +- test/code_commands/test_lint.py | 1 + test/code_commands/test_sim.py | 19 ++++++++++++++++--- test/code_commands/test_test.py | 19 ++++++++++++++++--- test/packages/test_complete.py | 2 ++ 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/test/code_commands/test_build.py b/test/code_commands/test_build.py index 55860d63..c70f30bf 100644 --- a/test/code_commands/test_build.py +++ b/test/code_commands/test_build.py @@ -2,7 +2,7 @@ Test for the "apio build" command """ -# -- This is for testing "apio build" +# -- apio build entry point from apio.commands.build import cli as cmd_build # -- This is for testing "apio init" diff --git a/test/code_commands/test_lint.py b/test/code_commands/test_lint.py index e56b71dc..de382eef 100644 --- a/test/code_commands/test_lint.py +++ b/test/code_commands/test_lint.py @@ -1,6 +1,7 @@ """ Test for the "apio lint" command """ +# -- apio lint entry point from apio.commands.lint import cli as cmd_lint diff --git a/test/code_commands/test_sim.py b/test/code_commands/test_sim.py index 311268fd..e753c65b 100644 --- a/test/code_commands/test_sim.py +++ b/test/code_commands/test_sim.py @@ -1,10 +1,23 @@ +""" + Test for the "apio sim" command +""" + +# -- apio sim entry point from apio.commands.sim import cli as cmd_sim def test_sim(clirunner, configenv): + """Test: apio sim + when no apio.ini file is given + No additional parameters are given + """ + with clirunner.isolated_filesystem(): + + # -- Config the environment (conftest.configenv()) configenv() - result = clirunner.invoke(cmd_sim, ['--board', 'icezum']) + + # -- apio sim --board icezum + result = clirunner.invoke(cmd_sim) assert result.exit_code != 0 - if result.exit_code == 1: - assert 'apio install iverilog' in result.output + # -- TODO diff --git a/test/code_commands/test_test.py b/test/code_commands/test_test.py index bff2e062..575dd7bd 100644 --- a/test/code_commands/test_test.py +++ b/test/code_commands/test_test.py @@ -1,10 +1,23 @@ +""" + Test for the "apio test" command +""" + +# -- apio test entry point from apio.commands.sim import cli as cmd_test def test_test(clirunner, configenv): + """Test: apio test + when no apio.ini file is given + No additional parameters are given + """ + with clirunner.isolated_filesystem(): + + # -- Config the environment (conftest.configenv()) configenv() - result = clirunner.invoke(cmd_test, ['--board', 'icezum']) + + # -- Execute "apio test" + result = clirunner.invoke(cmd_test) assert result.exit_code != 0 - if result.exit_code == 1: - assert 'apio install iverilog' in result.output + # -- TODO diff --git a/test/packages/test_complete.py b/test/packages/test_complete.py index 4d92e286..85759010 100644 --- a/test/packages/test_complete.py +++ b/test/packages/test_complete.py @@ -6,6 +6,8 @@ import pytest +#-- Entry point for the apio install, apio uninstall +#-- apio init, apio upload, apio examples from apio.commands.install import cli as cmd_install from apio.commands.uninstall import cli as cmd_uninstall from apio.commands.init import cli as cmd_init