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

20 statements  

« 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 

8 

9"""Test for the "apio" (root) command.""" 

10 

11from tests.conftest import ApioRunner 

12from apio.commands.apio import apio_top_cli as apio 

13 

14 

15def test_apio_cmd(apio_runner: ApioRunner): 

16 """Test the apio root command.""" 

17 

18 with apio_runner.in_sandbox() as sb: 

19 

20 # -- Run 'apio' 

21 result = sb.invoke_apio_cmd(apio, []) 

22 sb.assert_result_ok(result) 

23 assert "WORK WITH FPGAs WITH EASE." in result.output 

24 assert "Build commands:" in result.output 

25 assert "Upload the bitstream to the FPGA" in result.output 

26 

27 # -- Run 'apio --help' 

28 result = sb.invoke_apio_cmd(apio, ["--help"]) 

29 sb.assert_result_ok(result) 

30 assert "WORK WITH FPGAs WITH EASE." in result.output 

31 assert "Build commands:" in result.output 

32 assert "Upload the bitstream to the FPGA" in result.output 

33 

34 # -- Run 'apio --version' 

35 result = sb.invoke_apio_cmd(apio, ["--version"]) 

36 sb.assert_result_ok(result) 

37 assert "Apio CLI " in result.output 

38 

39 # -- Run 'apio badcommand' 

40 result = sb.invoke_apio_cmd(apio, ["badcommand"]) 

41 assert result.exit_code != 0 

42 assert "Error: No such command 'badcommand'" in result.output