Skip to content

Commit

Permalink
refactor test_install.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Feb 24, 2024
1 parent c703b78 commit d773e8f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions test/env_commands/test_install.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
from apio.commands.install import cli as cmd_install
"""
Test for the "apio install" command
"""

# -- apio install entry point
from apio.commands.install import cli as cmd_install

def test_install(clirunner, validate_cliresult):
result = clirunner.invoke(cmd_install)
validate_cliresult(result)

def test_install(clirunner, configenv, validate_cliresult):
"""Test "apio install" with different parameters"""

def test_install_list(clirunner, validate_cliresult, configenv):
with clirunner.isolated_filesystem():

# -- Config the environment (conftest.configenv())
configenv()
result = clirunner.invoke(cmd_install, ['--list'])

# -- Execute "apio install"
result = clirunner.invoke(cmd_install)
validate_cliresult(result)

# -- Execute "apio install --list"
result = clirunner.invoke(cmd_install, ['--list'])
validate_cliresult(result)

def test_install_wrong_package(clirunner, configenv):
with clirunner.isolated_filesystem():
configenv()
# -- Execute "apio install missing_package"
result = clirunner.invoke(cmd_install, ['missing_package'])
assert result.exit_code == 1
assert 'Error: no such package' in result.output

0 comments on commit d773e8f

Please sign in to comment.