Coverage for tests/unit_tests/commands/test_apio_lint.py: 100%
13 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-06 10:20 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-06 10:20 +0000
1"""Test for the "apio lint" command."""
3from tests.conftest import ApioRunner
4from apio.commands.apio import apio_top_cli as apio
7def test_lint_apio_init(apio_runner: ApioRunner):
8 """Test: apio lint without an apio.ini project file."""
10 with apio_runner.in_sandbox() as sb:
12 # -- Execute "apio lint"
13 result = sb.invoke_apio_cmd(apio, ["lint"])
14 assert result.exit_code == 1, result.output
15 assert "Error: Missing project file apio.ini" in result.output
18def test_lint_with_env_arg_error(apio_runner: ApioRunner):
19 """Tests the command with an invalid --env value. This error message
20 confirms that the --env arg was propagated to the apio.ini loading
21 logic."""
23 with apio_runner.in_sandbox() as sb:
25 # -- Run "apio lint --env no-such-env"
26 sb.write_apio_ini({"[env:default]": {"top-module": "main"}})
27 result = sb.invoke_apio_cmd(apio, ["lint", "--env", "no-such-env"])
28 assert result.exit_code == 1, result.output
29 assert (
30 "Error: Env 'no-such-env' not found in apio.ini" in result.output
31 )