Coverage for tests/unit_tests/commands/test_apio_upload.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 upload" command."""
3from tests.conftest import ApioRunner
4from apio.commands.apio import apio_top_cli as apio
7def test_upload_without_apio_ini(apio_runner: ApioRunner):
8 """Test: apio upload
9 when no apio.ini file is given
10 No additional parameters are given
11 """
13 with apio_runner.in_sandbox() as sb:
15 # -- Execute "apio upload"
16 result = sb.invoke_apio_cmd(apio, ["upload"])
18 # -- Check the result
19 assert result.exit_code == 1, result.output
20 assert "Error: Missing project file apio.ini" in result.output
23def test_upload_with_env_arg_error(apio_runner: ApioRunner):
24 """Tests the command with an invalid --env value. This error message
25 confirms that the --env arg was propagated to the apio.ini loading
26 logic."""
28 with apio_runner.in_sandbox() as sb:
30 # -- Run "apio upload --env no-such-env"
31 sb.write_apio_ini({"[env:default]": {"top-module": "main"}})
32 result = sb.invoke_apio_cmd(apio, ["upload", "--env", "no-such-env"])
33 assert result.exit_code == 1, result.output
34 assert (
35 "Error: Env 'no-such-env' not found in apio.ini" in result.output
36 )