summaryrefslogtreecommitdiff
path: root/tests/test_pylint_runners.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-09-04 13:04:45 +0200
committerGitHub <noreply@github.com>2022-09-04 13:04:45 +0200
commitc2989ad5c71b3e1be0f0a7e5297f9b7e47fa2766 (patch)
tree89f867543fdf13470f0dddfc509686fe137c60a8 /tests/test_pylint_runners.py
parentcd7761d4fcdf1d6d3ad19b34a426a7033b41cc1a (diff)
downloadpylint-git-c2989ad5c71b3e1be0f0a7e5297f9b7e47fa2766.tar.gz
Complete typing of all generic types (#7406)
And update ``mypy`` configuration
Diffstat (limited to 'tests/test_pylint_runners.py')
-rw-r--r--tests/test_pylint_runners.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_pylint_runners.py b/tests/test_pylint_runners.py
index bae13568c..0e048d0c2 100644
--- a/tests/test_pylint_runners.py
+++ b/tests/test_pylint_runners.py
@@ -8,9 +8,9 @@ from __future__ import annotations
import os
import pathlib
import sys
-from collections.abc import Callable
+from collections.abc import Sequence
from io import BufferedReader
-from typing import Any
+from typing import Any, NoReturn
from unittest.mock import MagicMock, mock_open, patch
import pytest
@@ -20,11 +20,21 @@ from pylint import run_epylint, run_pylint, run_pyreverse, run_symilar
from pylint.lint import Run
from pylint.testutils import GenericTestReporter as Reporter
+if sys.version_info >= (3, 8):
+ from typing import Protocol
+else:
+ from typing_extensions import Protocol
+
+
+class _RunCallable(Protocol): # pylint: disable=too-few-public-methods
+ def __call__(self, argv: Sequence[str] | None = None) -> NoReturn | None:
+ ...
+
@pytest.mark.parametrize(
"runner", [run_epylint, run_pylint, run_pyreverse, run_symilar]
)
-def test_runner(runner: Callable, tmpdir: LocalPath) -> None:
+def test_runner(runner: _RunCallable, tmpdir: LocalPath) -> None:
filepath = os.path.abspath(__file__)
testargs = ["", filepath]
with tmpdir.as_cwd():
@@ -37,7 +47,7 @@ def test_runner(runner: Callable, tmpdir: LocalPath) -> None:
@pytest.mark.parametrize(
"runner", [run_epylint, run_pylint, run_pyreverse, run_symilar]
)
-def test_runner_with_arguments(runner: Callable, tmpdir: LocalPath) -> None:
+def test_runner_with_arguments(runner: _RunCallable, tmpdir: LocalPath) -> None:
"""Check the runners with arguments as parameter instead of sys.argv."""
filepath = os.path.abspath(__file__)
testargs = [filepath]