diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-07-14 22:22:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 22:22:54 +0200 |
commit | 6417e8cdee987afb773ad5ab9f5f0e82028c7cac (patch) | |
tree | e8e770d07deda8ad6db09b85444c058299e25628 /tests/pyreverse | |
parent | dd5e2c7762294ae91f0e8e850224c14652dd23c6 (diff) | |
download | pylint-git-6417e8cdee987afb773ad5ab9f5f0e82028c7cac.tar.gz |
[typing] Add typing to the tests directory (#7183)
Diffstat (limited to 'tests/pyreverse')
-rw-r--r-- | tests/pyreverse/test_main.py | 11 | ||||
-rw-r--r-- | tests/pyreverse/test_printer.py | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/pyreverse/test_main.py b/tests/pyreverse/test_main.py index 69a6ddb26..55c6ea1ec 100644 --- a/tests/pyreverse/test_main.py +++ b/tests/pyreverse/test_main.py @@ -13,6 +13,7 @@ from typing import Any from unittest import mock import pytest +from _pytest.capture import CaptureFixture from pylint.lint import fix_import_path from pylint.pyreverse import main @@ -55,7 +56,7 @@ def setup_path(request) -> Iterator: @pytest.mark.usefixtures("setup_path") -def test_project_root_in_sys_path(): +def test_project_root_in_sys_path() -> None: """Test the context manager adds the project root directory to sys.path. This should happen when pyreverse is run from any directory """ @@ -67,7 +68,7 @@ def test_project_root_in_sys_path(): @mock.patch("pylint.pyreverse.main.DiadefsHandler", new=mock.MagicMock()) @mock.patch("pylint.pyreverse.main.writer") @pytest.mark.usefixtures("mock_graphviz") -def test_graphviz_supported_image_format(mock_writer, capsys): +def test_graphviz_supported_image_format(mock_writer, capsys: CaptureFixture) -> None: """Test that Graphviz is used if the image format is supported.""" with pytest.raises(SystemExit) as wrapped_sysexit: # we have to catch the SystemExit so the test execution does not stop @@ -87,8 +88,8 @@ def test_graphviz_supported_image_format(mock_writer, capsys): @mock.patch("pylint.pyreverse.main.writer") @pytest.mark.usefixtures("mock_graphviz") def test_graphviz_cant_determine_supported_formats( - mock_writer, mock_subprocess, capsys -): + mock_writer, mock_subprocess, capsys: CaptureFixture +) -> None: """Test that Graphviz is used if the image format is supported.""" mock_subprocess.run.return_value.stderr = "..." with pytest.raises(SystemExit) as wrapped_sysexit: @@ -108,7 +109,7 @@ def test_graphviz_cant_determine_supported_formats( @mock.patch("pylint.pyreverse.main.DiadefsHandler", new=mock.MagicMock()) @mock.patch("pylint.pyreverse.main.writer", new=mock.MagicMock()) @pytest.mark.usefixtures("mock_graphviz") -def test_graphviz_unsupported_image_format(capsys): +def test_graphviz_unsupported_image_format(capsys: CaptureFixture) -> None: """Test that Graphviz is used if the image format is supported.""" with pytest.raises(SystemExit) as wrapped_sysexit: # we have to catch the SystemExit so the test execution does not stop diff --git a/tests/pyreverse/test_printer.py b/tests/pyreverse/test_printer.py index 3822383db..d6785940f 100644 --- a/tests/pyreverse/test_printer.py +++ b/tests/pyreverse/test_printer.py @@ -44,7 +44,7 @@ def test_unsupported_layout(layout: Layout, printer_class: type[Printer]): printer_class(title="unittest", layout=layout) -def test_method_arguments_none(): +def test_method_arguments_none() -> None: func = nodes.FunctionDef() args = nodes.Arguments() args.args = None |