Skip to content

Commit

Permalink
refactor test_sim.py and test_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 24, 2024
1 parent 79d6ca4 commit 80cd68c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/code_commands/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions test/code_commands/test_lint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test for the "apio lint" command
"""
# -- apio lint entry point
from apio.commands.lint import cli as cmd_lint


Expand Down
19 changes: 16 additions & 3 deletions test/code_commands/test_sim.py
Original file line number Diff line number Diff line change
@@ -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
19 changes: 16 additions & 3 deletions test/code_commands/test_test.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions test/packages/test_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80cd68c

Please sign in to comment.