Coverage for tests/unit_tests/commands/test_apio_test.py: 100%
13 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-07 05:08 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-07 05:08 +0000
1# This file is part of the Apio project
2# (C) 2016-present FPGAwars
3# Project authors:
4# * Jesús Arroyo (Jesus89) (2016-2019)
5# * Juan Gonzalez (obijuan) (2019-2024)
6# * The Apio Team (2024-present)
7# License: GPLv2
9"""Test for the "apio test" command."""
11from tests.conftest import ApioRunner
12from apio.commands.apio import apio_top_cli as apio
15def test_test(apio_runner: ApioRunner):
16 """Test: apio test
17 when no apio.ini file is given
18 No additional parameters are given
19 """
21 with apio_runner.in_sandbox() as sb:
23 # -- Execute "apio test"
24 result = sb.invoke_apio_cmd(apio, ["test"])
25 assert result.exit_code != 0, result.output
26 assert "Error: Missing project file apio.ini" in result.output
29def test_with_env_arg_error(apio_runner: ApioRunner):
30 """Tests the command with an invalid --env value. This error message
31 confirms that the --env arg was propagated to the apio.ini loading
32 logic."""
34 with apio_runner.in_sandbox() as sb:
36 # -- Run "apio test --env no-such-env"
37 sb.write_apio_ini({"[env:default]": {"top-module": "main"}})
38 result = sb.invoke_apio_cmd(apio, ["test", "--env", "no-such-env"])
39 assert result.exit_code == 1, result.output
40 assert (
41 "Error: Env 'no-such-env' not found in apio.ini" in result.output
42 )