Coverage for tests\test_cli.py: 100.00%

8 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-22 23:23 +0100

1# -*- coding: utf-8 -*- 

2 

3""" 

4* Name: interactive-clustering-gui/tests/test_cli.py 

5* Description: Unittests for `cli` module. 

6* Author: Erwan Schild 

7* Created: 22/02/2022 

8* Licence: CeCILL (https://cecill.info/licences.fr.html) 

9""" 

10 

11# ============================================================================== 

12# IMPORT PYTHON DEPENDENCIES 

13# ============================================================================== 

14 

15import pytest 

16 

17from cognitivefactory.interactive_clustering_gui.cli import main 

18 

19# ============================================================================== 

20# test_main_help 

21# ============================================================================== 

22 

23 

24def test_main_help(capsys): 

25 """ 

26 Test the CLI help display. 

27 

28 Arguments: 

29 capsys: Pytest fixture to capture output. 

30 """ 

31 

32 # Request the help of the CLI. 

33 with pytest.raises(SystemExit): 

34 main(["-h"]) 

35 

36 # Capture the output and check it. 

37 captured = capsys.readouterr() 

38 assert "cognitivefactory-interactive-clustering-gui" in captured.out