Coverage for tests/unit_tests/commands/test_apio_sim.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-06 10:20 +0000

1"""Test for the "apio sim" command""" 

2 

3from tests.conftest import ApioRunner 

4from apio.commands.apio import apio_top_cli as apio 

5 

6 

7def test_sim(apio_runner: ApioRunner): 

8 """Test: apio sim 

9 when no apio.ini file is given 

10 No additional parameters are given 

11 """ 

12 

13 with apio_runner.in_sandbox() as sb: 

14 

15 # -- apio sim 

16 result = sb.invoke_apio_cmd(apio, ["sim"]) 

17 assert result.exit_code != 0, result.output 

18 # -- TODO 

19 

20 

21def test_sim_with_env_arg_error(apio_runner: ApioRunner): 

22 """Tests the command with an invalid --env value. This error message 

23 confirms that the --env arg was propagated to the apio.ini loading 

24 logic.""" 

25 

26 with apio_runner.in_sandbox() as sb: 

27 

28 # -- Run "apio sim --env no-such-env" 

29 sb.write_apio_ini({"[env:default]": {"top-module": "main"}}) 

30 result = sb.invoke_apio_cmd(apio, ["sim", "--env", "no-such-env"]) 

31 assert result.exit_code == 1, result.output 

32 assert ( 

33 "Error: Env 'no-such-env' not found in apio.ini" in result.output 

34 )