diff options
Diffstat (limited to 'tests/test_config.py')
-rw-r--r-- | tests/test_config.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 1c33ef039..7a4b09639 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,14 +1,16 @@ # pylint: disable=missing-module-docstring, missing-function-docstring, protected-access import os import unittest.mock +from pathlib import PosixPath import pytest import pylint.lint from pylint.config import OptionsManagerMixIn +from pylint.lint.run import Run -def check_configuration_file_reader(config_file): +def check_configuration_file_reader(config_file: PosixPath) -> Run: """Initialize pylint with the given configuration file and check that what we initialized the linter with what was expected. """ @@ -34,7 +36,7 @@ def check_configuration_file_reader(config_file): return runner -def test_can_read_ini(tmp_path): +def test_can_read_ini(tmp_path: PosixPath) -> None: # Check that we can read the "regular" INI .pylintrc file config_file = tmp_path / ".pylintrc" config_file.write_text( @@ -48,7 +50,7 @@ reports = yes check_configuration_file_reader(config_file) -def test_can_read_setup_cfg(tmp_path): +def test_can_read_setup_cfg(tmp_path: PosixPath) -> None: # Check that we can read a setup.cfg (which is an INI file where # section names are prefixed with "pylint." config_file = tmp_path / "setup.cfg" @@ -63,7 +65,7 @@ reports = yes check_configuration_file_reader(config_file) -def test_can_read_toml(tmp_path): +def test_can_read_toml(tmp_path: PosixPath) -> None: # Check that we can read a TOML file where lists and integers are # expressed as strings. config_file = tmp_path / "pyproject.toml" @@ -78,7 +80,7 @@ reports = "yes" check_configuration_file_reader(config_file) -def test_can_read_toml_rich_types(tmp_path): +def test_can_read_toml_rich_types(tmp_path: PosixPath) -> None: # Check that we can read a TOML file where lists, integers and # booleans are expressed as such (and not as strings), using TOML # type system. @@ -97,7 +99,7 @@ reports = true check_configuration_file_reader(config_file) -def test_can_read_env_variable(tmp_path): +def test_can_read_env_variable(tmp_path: PosixPath) -> None: # Check that we can read the "regular" INI .pylintrc file # if it has an environment variable. config_file = tmp_path / "pyproject.toml" @@ -113,7 +115,7 @@ reports = "yes" options_manager_mix_in = OptionsManagerMixIn("", "${tmp_path_env}") options_manager_mix_in.read_config_file("${tmp_path_env}") - def test_read_config_file(): + def test_read_config_file() -> None: with pytest.raises(OSError): options_manager_mix_in.read_config_file("${tmp_path_en}") |