11"""Test cases for the __main__ module."""
22from unittest .mock import Mock
33
4- from click .testing import CliRunner
54import pytest
5+ from click .testing import CliRunner
66from pytest_mock import MockFixture
77
88from toml_validator import __main__
99
1010
1111@pytest .fixture
12- def runner ():
12+ def runner () -> CliRunner :
13+ """Fixture for invoking command-line interfaces."""
1314 return CliRunner ()
1415
1516
@@ -36,6 +37,7 @@ def mock_validation_validate_toml_with_error(mocker: MockFixture) -> Mock:
3637
3738
3839def test_main_without_argument (runner : CliRunner ):
40+ """It exits with a status code of 2."""
3941 result = runner .invoke (__main__ .main )
4042 assert result .exit_code == 2
4143
@@ -45,6 +47,7 @@ def test_main_with_argument_success(
4547 mock_validation_validate_extension : Mock ,
4648 mock_validation_validate_toml_no_error : Mock ,
4749):
50+ """It exits with a status code of zero."""
4851 with runner .isolated_filesystem ():
4952 with open ("file.toml" , "w" ) as f :
5053 f .write ("content doesnt matter" )
@@ -61,6 +64,7 @@ def test_main_with_argument_fail(
6164 mock_validation_validate_extension : Mock ,
6265 mock_validation_validate_toml_with_error : Mock ,
6366):
67+ """It outputs error."""
6468 with runner .isolated_filesystem ():
6569 with open ("file.toml" , "w" ) as f :
6670 f .write ("content doesnt matter" )
@@ -74,5 +78,6 @@ def test_main_with_argument_fail(
7478
7579@pytest .mark .e2e
7680def test_main_without_arguments_in_production_env (runner : CliRunner ):
81+ """It exits with a status code of 2 (e2e)."""
7782 result = runner .invoke (__main__ .main )
7883 assert result .exit_code == 2
0 commit comments