11"""Test cases for the __main__ module."""
2- from typing import Any
32from unittest .mock import Mock
43
4+ import click .testing
55import pytest
6- from click .testing import CliRunner
76from pytest_mock import MockFixture
87
98from toml_validator import __main__
109
1110
1211@pytest .fixture
13- def runner () -> CliRunner :
12+ def runner () -> click . testing . CliRunner :
1413 """Fixture for invoking command-line interfaces."""
15- return CliRunner ()
14+ return click . testing . CliRunner ()
1615
1716
1817@pytest .fixture
19- def mock_validation_validate_extension (mocker : MockFixture ) -> Any :
18+ def mock_validation_validate_extension (mocker : MockFixture ) -> Mock :
2019 """Fixture for mocking validation.validate_extension."""
2120 return mocker .patch ("toml_validator.validation.validate_extension" )
2221
2322
2423@pytest .fixture
25- def mock_validation_validate_toml_no_error (mocker : MockFixture ) -> Any :
24+ def mock_validation_validate_toml_no_error (mocker : MockFixture ) -> Mock :
2625 """Fixture for mocking validation.validate_toml with no errors."""
2726 mock = mocker .patch ("toml_validator.validation.validate_toml" )
2827 mock .return_value = ""
2928 return mock
3029
3130
3231@pytest .fixture
33- def mock_validation_validate_toml_with_error (mocker : MockFixture ) -> Any :
32+ def mock_validation_validate_toml_with_error (mocker : MockFixture ) -> Mock :
3433 """Fixture for mocking validation.validate_toml with error."""
3534 mock = mocker .patch ("toml_validator.validation.validate_toml" )
3635 mock .return_value = "|some error description|"
3736 return mock
3837
3938
40- def test_main_without_argument (runner : CliRunner ) -> None :
39+ def test_main_without_argument (runner : click . testing . CliRunner ) -> None :
4140 """It exits with a status code of 2."""
4241 result = runner .invoke (__main__ .main )
4342 assert result .exit_code == 2
4443
4544
4645def test_main_with_argument_success (
47- runner : CliRunner ,
46+ runner : click . testing . CliRunner ,
4847 mock_validation_validate_extension : Mock ,
4948 mock_validation_validate_toml_no_error : Mock ,
5049) -> None :
@@ -61,7 +60,7 @@ def test_main_with_argument_success(
6160
6261
6362def test_main_with_argument_fail (
64- runner : CliRunner ,
63+ runner : click . testing . CliRunner ,
6564 mock_validation_validate_extension : Mock ,
6665 mock_validation_validate_toml_with_error : Mock ,
6766) -> None :
@@ -78,7 +77,9 @@ def test_main_with_argument_fail(
7877
7978
8079@pytest .mark .e2e
81- def test_main_without_arguments_in_production_env (runner : CliRunner ) -> None :
80+ def test_main_without_arguments_in_production_env (
81+ runner : click .testing .CliRunner ,
82+ ) -> None :
8283 """It exits with a status code of 2 (e2e)."""
8384 result = runner .invoke (__main__ .main )
8485 assert result .exit_code == 2
0 commit comments