Skip to content

Commit

Permalink
refactor test_system.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 24, 2024
1 parent d773e8f commit aeb2429
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions test/env_commands/test_system.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
"""
Test for the "apio system" command
"""

# -- apio system entry point
from apio.commands.system import cli as cmd_system


def test_system(clirunner, validate_cliresult, configenv):
result = clirunner.invoke(cmd_system)
validate_cliresult(result)

"""Test "apio system" with different parameters"""

def test_system_lsftdi(clirunner, configenv):
with clirunner.isolated_filesystem():

# -- Config the environment (conftest.configenv())
configenv()

# -- Execute "apio system"
result = clirunner.invoke(cmd_system)
validate_cliresult(result)

# -- Execute "apio system --lsftdi"
result = clirunner.invoke(cmd_system, ['--lsftdi'])
assert result.exit_code == 1
assert 'apio install oss-cad-suite' in result.output


def test_system_lsusb(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio system --lsusb"
result = clirunner.invoke(cmd_system, ['--lsusb'])
assert result.exit_code == 1
assert 'apio install oss-cad-suite' in result.output


def test_system_lsserial(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio system --lsserial"
clirunner.invoke(cmd_system, ['--lsserial'])
assert result.exit_code == 1
assert 'apio install oss-cad-suite' in result.output


def test_system_info(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio system --info"
result = clirunner.invoke(cmd_system, ['--info'])
assert result.exit_code == 0
assert "Platform:" in result.output

0 comments on commit aeb2429

Please sign in to comment.