diff options
Diffstat (limited to 'tests')
414 files changed, 1278 insertions, 1757 deletions
diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py index 42521b593..e663aa4b0 100644 --- a/tests/benchmark/test_baseline_benchmarks.py +++ b/tests/benchmark/test_baseline_benchmarks.py @@ -1,8 +1,8 @@ """Profiles basic -jX functionality.""" # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=missing-function-docstring diff --git a/tests/checkers/base/unittest_base.py b/tests/checkers/base/unittest_base.py index 99a8f659e..8e432bffb 100644 --- a/tests/checkers/base/unittest_base.py +++ b/tests/checkers/base/unittest_base.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unittest for the base checker.""" diff --git a/tests/checkers/base/unittest_multi_naming_style.py b/tests/checkers/base/unittest_multi_naming_style.py index 457913149..5e17e6411 100644 --- a/tests/checkers/base/unittest_multi_naming_style.py +++ b/tests/checkers/base/unittest_multi_naming_style.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unittest for the NameChecker.""" diff --git a/tests/checkers/base/unittest_name_preset.py b/tests/checkers/base/unittest_name_preset.py index 49a81deff..412e2ee8e 100644 --- a/tests/checkers/base/unittest_name_preset.py +++ b/tests/checkers/base/unittest_name_preset.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unittest for the NameChecker.""" diff --git a/tests/checkers/conftest.py b/tests/checkers/conftest.py index ac2a187d4..c91a97198 100644 --- a/tests/checkers/conftest.py +++ b/tests/checkers/conftest.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pathlib import Path diff --git a/tests/checkers/unittest_base_checker.py b/tests/checkers/unittest_base_checker.py index 81a9c73d0..4c4b6d563 100644 --- a/tests/checkers/unittest_base_checker.py +++ b/tests/checkers/unittest_base_checker.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unittest for the BaseChecker class.""" @@ -132,16 +132,5 @@ def test_base_checker_ordering() -> None: def test_base_checker_invalid_message() -> None: linter = PyLinter() - with pytest.raises(InvalidMessageError): linter.register_checker(MissingFieldsChecker(linter)) - - -def test_get_message_definition() -> None: - checker = LessBasicChecker() - with pytest.warns(DeprecationWarning): - with pytest.raises(InvalidMessageError): - checker.get_message_definition("W123") - - with pytest.warns(DeprecationWarning): - assert checker.get_message_definition("W0001") diff --git a/tests/checkers/unittest_deprecated.py b/tests/checkers/unittest_deprecated.py index d34150247..a9efaa505 100644 --- a/tests/checkers/unittest_deprecated.py +++ b/tests/checkers/unittest_deprecated.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/checkers/unittest_design.py b/tests/checkers/unittest_design.py index f2ea09d2d..379fee559 100644 --- a/tests/checkers/unittest_design.py +++ b/tests/checkers/unittest_design.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import astroid diff --git a/tests/checkers/unittest_format.py b/tests/checkers/unittest_format.py index fd0699daa..dfaf037b9 100644 --- a/tests/checkers/unittest_format.py +++ b/tests/checkers/unittest_format.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Check format checker helper functions.""" @@ -148,9 +148,10 @@ class TestCheckSpace(CheckerTestCase): encoding_token = tokenize.TokenInfo( tokenize.ENCODING, "utf-8", (0, 0), (0, 0), "" ) - tokens = [encoding_token] + _tokenize_str( - "if (\n None):\n pass\n" - ) + tokens = [ + encoding_token, + *_tokenize_str("if (\n None):\n pass\n"), + ] self.checker.process_tokens(tokens) diff --git a/tests/checkers/unittest_imports.py b/tests/checkers/unittest_imports.py index d454c8161..4a8d6e553 100644 --- a/tests/checkers/unittest_imports.py +++ b/tests/checkers/unittest_imports.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unit tests for the imports checker.""" diff --git a/tests/checkers/unittest_misc.py b/tests/checkers/unittest_misc.py index e360d3bb6..2f292b81f 100644 --- a/tests/checkers/unittest_misc.py +++ b/tests/checkers/unittest_misc.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Tests for the misc checker.""" diff --git a/tests/checkers/unittest_non_ascii_name.py b/tests/checkers/unittest_non_ascii_name.py index 4f854dddc..0741a9fb0 100644 --- a/tests/checkers/unittest_non_ascii_name.py +++ b/tests/checkers/unittest_non_ascii_name.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/checkers/unittest_refactoring.py b/tests/checkers/unittest_refactoring.py index d40e0eb92..30b1dce2e 100644 --- a/tests/checkers/unittest_refactoring.py +++ b/tests/checkers/unittest_refactoring.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import os diff --git a/tests/checkers/unittest_similar.py b/tests/checkers/unittest_similar.py index c0f0cdcbf..f5bfc6fb2 100644 --- a/tests/checkers/unittest_similar.py +++ b/tests/checkers/unittest_similar.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from contextlib import redirect_stdout from io import StringIO diff --git a/tests/checkers/unittest_spelling.py b/tests/checkers/unittest_spelling.py index b02cf73a8..08c1fa051 100644 --- a/tests/checkers/unittest_spelling.py +++ b/tests/checkers/unittest_spelling.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unittest for the spelling checker.""" diff --git a/tests/checkers/unittest_stdlib.py b/tests/checkers/unittest_stdlib.py index 66747deb9..df0bcfd51 100644 --- a/tests/checkers/unittest_stdlib.py +++ b/tests/checkers/unittest_stdlib.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -48,7 +48,14 @@ class TestStdlibChecker(CheckerTestCase): inner_node: nodes.Name, context: InferenceContext | None = None, # pylint: disable=unused-argument ) -> Iterator[nodes.AssignAttr]: - new_node = nodes.AssignAttr(attrname="alpha", parent=inner_node) + new_node = nodes.AssignAttr( + attrname="alpha", + parent=inner_node, + lineno=0, + col_offset=0, + end_lineno=0, + end_col_offset=0, + ) yield new_node manager = astroid.MANAGER diff --git a/tests/checkers/unittest_strings.py b/tests/checkers/unittest_strings.py index 7927dcc49..6c93e0865 100644 --- a/tests/checkers/unittest_strings.py +++ b/tests/checkers/unittest_strings.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pylint.checkers import strings diff --git a/tests/checkers/unittest_typecheck.py b/tests/checkers/unittest_typecheck.py index dba69eaf3..c944b863f 100644 --- a/tests/checkers/unittest_typecheck.py +++ b/tests/checkers/unittest_typecheck.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import astroid import pytest diff --git a/tests/checkers/unittest_unicode/__init__.py b/tests/checkers/unittest_unicode/__init__.py index 3f516f032..bb7a14a70 100644 --- a/tests/checkers/unittest_unicode/__init__.py +++ b/tests/checkers/unittest_unicode/__init__.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import io from pathlib import Path diff --git a/tests/checkers/unittest_unicode/unittest_bad_chars.py b/tests/checkers/unittest_unicode/unittest_bad_chars.py index 7746ce4ae..e5cdcfe04 100644 --- a/tests/checkers/unittest_unicode/unittest_bad_chars.py +++ b/tests/checkers/unittest_unicode/unittest_bad_chars.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name diff --git a/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py b/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py index 6b11dcfef..95b2b4602 100644 --- a/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py +++ b/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import itertools import unicodedata diff --git a/tests/checkers/unittest_unicode/unittest_functions.py b/tests/checkers/unittest_unicode/unittest_functions.py index 0c809ccdc..09401fd64 100644 --- a/tests/checkers/unittest_unicode/unittest_functions.py +++ b/tests/checkers/unittest_unicode/unittest_functions.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/checkers/unittest_unicode/unittest_invalid_encoding.py b/tests/checkers/unittest_unicode/unittest_invalid_encoding.py index e8695a74f..34e344281 100644 --- a/tests/checkers/unittest_unicode/unittest_invalid_encoding.py +++ b/tests/checkers/unittest_unicode/unittest_invalid_encoding.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/checkers/unittest_utils.py b/tests/checkers/unittest_utils.py index ac328d7cd..9d90d4c01 100644 --- a/tests/checkers/unittest_utils.py +++ b/tests/checkers/unittest_utils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Tests for the pylint.checkers.utils module.""" @@ -11,7 +11,6 @@ import pytest from astroid import nodes from pylint.checkers import utils -from pylint.checkers.base_checker import BaseChecker @pytest.mark.parametrize( @@ -414,7 +413,6 @@ def test_if_sys_guard() -> None: assert utils.is_sys_guard(code[2]) is False -@pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_if_typing_guard() -> None: code = astroid.extract_node( """ @@ -422,30 +420,30 @@ def test_if_typing_guard() -> None: import typing as t from typing import TYPE_CHECKING - if typing.TYPE_CHECKING: #@ - pass + if typing.TYPE_CHECKING: + pass #@ - if t.TYPE_CHECKING: #@ - pass + if t.TYPE_CHECKING: + pass #@ - if TYPE_CHECKING: #@ - pass + if TYPE_CHECKING: + pass #@ - if typing.SOME_OTHER_CONST: #@ - pass + if typing.SOME_OTHER_CONST: + pass #@ """ ) assert isinstance(code, list) and len(code) == 4 - assert isinstance(code[0], nodes.If) - assert utils.is_typing_guard(code[0]) is True - assert isinstance(code[1], nodes.If) - assert utils.is_typing_guard(code[1]) is True - assert isinstance(code[2], nodes.If) - assert utils.is_typing_guard(code[2]) is True + assert isinstance(code[0], nodes.Pass) + assert utils.in_type_checking_block(code[0]) is True + assert isinstance(code[1], nodes.Pass) + assert utils.in_type_checking_block(code[1]) is True + assert isinstance(code[2], nodes.Pass) + assert utils.in_type_checking_block(code[2]) is True - assert isinstance(code[3], nodes.If) - assert utils.is_typing_guard(code[3]) is False + assert isinstance(code[3], nodes.Pass) + assert utils.in_type_checking_block(code[3]) is False def test_in_type_checking_block() -> None: @@ -480,30 +478,6 @@ def test_is_empty_literal() -> None: assert not utils.is_empty_str_literal(not_empty_string_node.value) -def test_deprecation_is_inside_lambda() -> None: - """Test that is_inside_lambda is throwing a DeprecationWarning.""" - with pytest.warns(DeprecationWarning) as records: - utils.is_inside_lambda(nodes.NodeNG()) - assert len(records) == 1 - - -def test_deprecation_check_messages() -> None: - with pytest.warns(DeprecationWarning) as records: - - class Checker(BaseChecker): # pylint: disable=unused-variable - @utils.check_messages("my-message") - def visit_assname(self, node: nodes.NodeNG) -> None: - pass - - deprecationMessage = ( - "utils.check_messages will be removed in " - "favour of calling utils.only_required_for_messages in pylint 3.0" - ) - - assert len(records) == 1 - assert records[0].message.args[0] == deprecationMessage - - def test_is_typing_member() -> None: code = astroid.extract_node( """ diff --git a/tests/checkers/unittest_variables.py b/tests/checkers/unittest_variables.py index e3f013226..858873a36 100644 --- a/tests/checkers/unittest_variables.py +++ b/tests/checkers/unittest_variables.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import os import re @@ -151,7 +151,7 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase): # Undefined-method in class def # Issue 1824 - # https://github.com/PyCQA/pylint/issues/1824 + # https://github.com/pylint-dev/pylint/issues/1824 node = astroid.parse( """ class MyObject(object): @@ -166,7 +166,7 @@ class TestVariablesCheckerWithTearDown(CheckerTestCase): """Make sure variables from parent lambdas aren't noted as undefined - https://github.com/PyCQA/pylint/issues/760 + https://github.com/pylint-dev/pylint/issues/760 """ node = astroid.parse( """ diff --git a/tests/config/conftest.py b/tests/config/conftest.py index 491b16267..a5f9a7125 100644 --- a/tests/config/conftest.py +++ b/tests/config/conftest.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pathlib import Path diff --git a/tests/config/file_to_lint.py b/tests/config/file_to_lint.py index b6a8c14c8..174cc5609 100644 --- a/tests/config/file_to_lint.py +++ b/tests/config/file_to_lint.py @@ -1,5 +1,5 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Perfect module with only documentation for configuration tests.""" diff --git a/tests/config/functional/ini/pylintrc_with_deleted_message.8.out b/tests/config/functional/ini/pylintrc_with_deleted_message.8.out index bb7bad8d9..61044918d 100644 --- a/tests/config/functional/ini/pylintrc_with_deleted_message.8.out +++ b/tests/config/functional/ini/pylintrc_with_deleted_message.8.out @@ -1,3 +1,3 @@ ************* Module {abspath} -{relpath}:1:0: R0022: Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942. (useless-option-value) -{relpath}:1:0: R0022: Useless option value for '--enable', 'cmp-builtin' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942. (useless-option-value) +{relpath}:1:0: R0022: Useless option value for '--disable', 'buffer-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) +{relpath}:1:0: R0022: Useless option value for '--enable', 'cmp-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942. (useless-option-value) diff --git a/tests/config/functional/ini/pylintrc_with_deleted_message.ini b/tests/config/functional/ini/pylintrc_with_deleted_message.ini index 51b821750..89eaa715e 100644 --- a/tests/config/functional/ini/pylintrc_with_deleted_message.ini +++ b/tests/config/functional/ini/pylintrc_with_deleted_message.ini @@ -1,5 +1,5 @@ # Check that we raise an informational when a deleted messages exists in a .pylintrc file -# See https://github.com/PyCQA/pylint/issues/6794 +# See https://github.com/pylint-dev/pylint/issues/6794 [messages control] disable = logging-not-lazy, buffer-builtin enable = useless-option-value, locally-disabled, cmp-builtin diff --git a/tests/config/functional/ini/pylintrc_with_missing_comma.ini b/tests/config/functional/ini/pylintrc_with_missing_comma.ini index a30efed21..2242a23a1 100644 --- a/tests/config/functional/ini/pylintrc_with_missing_comma.ini +++ b/tests/config/functional/ini/pylintrc_with_missing_comma.ini @@ -1,5 +1,5 @@ # Check that we raise an warning when commas are missing in INI .pylintrc file -# See https://github.com/PyCQA/pylint/issues/3122 +# See https://github.com/pylint-dev/pylint/issues/3122 [messages control] disable = logging-not-lazylogging-format-interpolation enable = locally-disabled diff --git a/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini b/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini index 015246d5a..e1cd6876a 100644 --- a/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini +++ b/tests/config/functional/ini/pylintrc_with_multi_line_init_hook.ini @@ -1,4 +1,4 @@ -# Reported in https://github.com/PyCQA/pylint/issues/6888 +# Reported in https://github.com/pylint-dev/pylint/issues/6888 [MASTER] init-hook= try: import pylint_venv diff --git a/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini b/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini index 8b10877ed..415f57b0f 100644 --- a/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini +++ b/tests/config/functional/ini/pylintrc_with_quoted_init_hook.ini @@ -1,4 +1,4 @@ # Check that we support quoted init-hooks -# See https://github.com/PyCQA/pylint/issues/7006 +# See https://github.com/pylint-dev/pylint/issues/7006 [MAIN] init-hook='print("I should just print")' diff --git a/tests/config/functional/setup_cfg/deprecate_master/setup.cfg b/tests/config/functional/setup_cfg/deprecate_master/setup.cfg deleted file mode 100644 index fd6381646..000000000 --- a/tests/config/functional/setup_cfg/deprecate_master/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Test the deprecation of MASTER -[MASTER] -persistent=no diff --git a/tests/config/functional/setup_cfg/deprecate_master/setup.result.json b/tests/config/functional/setup_cfg/deprecate_master/setup.result.json deleted file mode 100644 index b66b78598..000000000 --- a/tests/config/functional/setup_cfg/deprecate_master/setup.result.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "persistent": false -} diff --git a/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg index 51a2c307b..042f53a83 100644 --- a/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg +++ b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg @@ -1,4 +1,4 @@ -# Test for the behavior of https://github.com/PyCQA/pylint/issues/4371 +# Test for the behavior of https://github.com/pylint-dev/pylint/issues/4371 [pylint.MAIN] persistent=no ignore = migrations diff --git a/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg b/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg index b045873c9..7a1d778c7 100644 --- a/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg +++ b/tests/config/functional/setup_cfg/issue_4272/option_in_wrong_section.cfg @@ -1,4 +1,4 @@ -# Test for the behaviour of https://github.com/PyCQA/pylint/issues/4272 +# Test for the behaviour of https://github.com/pylint-dev/pylint/issues/4272 [pylint.NOTMAIN] load-plugins=pylint.extensions.bad_builtin [pylint.MAIN] diff --git a/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml b/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml index da810e832..1c2ee3031 100644 --- a/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml +++ b/tests/config/functional/toml/issue_3122/toml_with_missing_comma.toml @@ -1,5 +1,5 @@ # Check that we raise an error when a comma is missing -# See https://github.com/PyCQA/pylint/issues/3122 +# See https://github.com/pylint-dev/pylint/issues/3122 [tool.pylint."messages control"] disable = "logging-not-lazylogging-format-interpolation,missing-docstring" enable = "locally-disabledsuppressed-message,missing-module-docstring" diff --git a/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml b/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml index 4d3f753d0..7ef4de4bf 100644 --- a/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml +++ b/tests/config/functional/toml/issue_3181/top_level_list_of_disable.toml @@ -1,4 +1,4 @@ -# This crashed previously see https://github.com/PyCQA/pylint/issues/3181 +# This crashed previously see https://github.com/pylint-dev/pylint/issues/3181 [tool.pylint] max-line-length = 120 disable = ["C0121"] diff --git a/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml b/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml index 691883527..65fe56090 100644 --- a/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml +++ b/tests/config/functional/toml/unknown_msgid/enable_unknown_msgid.toml @@ -1,5 +1,5 @@ # Check the behavior for unkonwn symbol/msgid -# (Originally) reported in https://github.com/PyCQA/pylint/pull/6293 +# (Originally) reported in https://github.com/pylint-dev/pylint/pull/6293 [tool.pylint."messages control"] disable = "logging-not-layzy,logging-format-interpolation" diff --git a/tests/config/functional/tox/unrecognized_options/tox.ini b/tests/config/functional/tox/unrecognized_options/tox.ini index 7bc38df51..e5db6d116 100644 --- a/tests/config/functional/tox/unrecognized_options/tox.ini +++ b/tests/config/functional/tox/unrecognized_options/tox.ini @@ -1,4 +1,4 @@ -; Test for https://github.com/PyCQA/pylint/issues/6800 +; Test for https://github.com/pylint-dev/pylint/issues/6800 [tox] skipsdist = True diff --git a/tests/config/pylint_config/test_pylint_config_generate.py b/tests/config/pylint_config/test_pylint_config_generate.py index adf7129a5..61f158aef 100644 --- a/tests/config/pylint_config/test_pylint_config_generate.py +++ b/tests/config/pylint_config/test_pylint_config_generate.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test for the 'pylint-config generate' command.""" diff --git a/tests/config/pylint_config/test_pylint_config_help.py b/tests/config/pylint_config/test_pylint_config_help.py index fcd57894a..5393a28fb 100644 --- a/tests/config/pylint_config/test_pylint_config_help.py +++ b/tests/config/pylint_config/test_pylint_config_help.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test for the 'pylint-config generate' command.""" diff --git a/tests/config/pylint_config/test_pylint_config_utils.py b/tests/config/pylint_config/test_pylint_config_utils.py index d41afec1d..b68e331fd 100644 --- a/tests/config/pylint_config/test_pylint_config_utils.py +++ b/tests/config/pylint_config/test_pylint_config_utils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test for the 'pylint-config' utils.""" diff --git a/tests/config/pylint_config/test_run_pylint_config.py b/tests/config/pylint_config/test_run_pylint_config.py index 9795e2183..1d282ed86 100644 --- a/tests/config/pylint_config/test_run_pylint_config.py +++ b/tests/config/pylint_config/test_run_pylint_config.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test for the 'pylint-config generate' command.""" diff --git a/tests/config/test_argparse_config.py b/tests/config/test_argparse_config.py index a9d7f70c2..dfa0fd4dd 100644 --- a/tests/config/test_argparse_config.py +++ b/tests/config/test_argparse_config.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test for the (new) implementation of option parsing with argparse""" diff --git a/tests/config/test_config.py b/tests/config/test_config.py index 5eab597fd..ff49d901e 100644 --- a/tests/config/test_config.py +++ b/tests/config/test_config.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -155,7 +155,7 @@ def test_short_verbose(capsys: CaptureFixture) -> None: def test_argument_separator() -> None: """Check that we support using '--' to separate argument types. - Reported in https://github.com/PyCQA/pylint/issues/7003. + Reported in https://github.com/pylint-dev/pylint/issues/7003. """ runner = Run(["--", str(EMPTY_MODULE)], exit=False) assert not runner.linter.stats.by_msg diff --git a/tests/config/test_deprecations.py b/tests/config/test_deprecations.py deleted file mode 100644 index 453a460d8..000000000 --- a/tests/config/test_deprecations.py +++ /dev/null @@ -1,121 +0,0 @@ -# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt - -"""Test for deprecation warnings in the config module.""" - - -import warnings - -import pytest - -from pylint.checkers import BaseChecker -from pylint.lint import PyLinter -from pylint.utils import get_global_option - - -class SampleChecker(BaseChecker): - options = (("test-opt", {"action": "store_true", "help": "help message"}),) - - -class SampleCheckerTwo(BaseChecker): - options = ( - ("test-opt-two", {"action": "store", "type": "string", "help": "help message"}), - ) - - -class SampleCheckerThree(BaseChecker): - options = ( - ( - "test-opt-three", - {"action": "store_true", "level": 1, "help": "help message"}, - ), - ) - - -class TestDeprecationArgumentsManager: - """Tests for deprecation warnings in the ArgumentsManager class.""" - - linter = PyLinter() - - @classmethod - def setup_class(cls) -> None: - checker = SampleChecker(cls.linter) - cls.linter.register_checker(checker) - with pytest.warns(DeprecationWarning): - cls.linter.register_options_provider(checker) - - def test_load_configuration(self) -> None: - """Test that load_configuration emits a DeprecationWarning.""" - - with pytest.warns(DeprecationWarning): - self.linter.load_configuration(test_opt=True) - - def test_load_configuration_from_config(self) -> None: - """Test that load_configuration_from_config emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.load_configuration_from_config({"test_opt": True}) - - def test_help_with_level(self) -> None: - """Test that help with a level argument raises a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.help(1) - - with pytest.warns(DeprecationWarning): - self.linter.help(level=1) - - with warnings.catch_warnings(): - warnings.simplefilter("error") - self.linter.help() - - def test_register_options_provider_load_defaults(self) -> None: - """Test that register_options_provider and load_defaults emits a DeprecationWarning.""" - checker = BaseChecker(self.linter) - with pytest.warns(DeprecationWarning): - self.linter.register_options_provider(checker) - with pytest.warns(DeprecationWarning): - self.linter.load_defaults() - - def test_get_global_option(self) -> None: - """Test that get_global_option emits a DeprecationWarning.""" - checker = BaseChecker(self.linter) - with pytest.warns(DeprecationWarning): - get_global_option(checker, "test-opt") # type: ignore[call-overload] - - def test_read_config_file(self) -> None: - """Test that read_config_file emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.read_config_file() - - def test_load_config_file(self) -> None: - """Test that load_config_file emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.load_config_file() - - def test_load_command_line_configuration(self) -> None: - """Test that load_command_line_configuration emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.load_command_line_configuration([]) - - def test_cb_set_provider_option(self) -> None: - """Test that cb_set_provider_option emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.cb_set_provider_option(None, "--test-opt", True, None) - - def test_level_attribute(self) -> None: - """Test that the level attribute emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - self.linter.level = 1 - - with pytest.warns(DeprecationWarning): - assert self.linter.level is not None - - def test_no_default_in_optdict(self) -> None: - """Test that not having a default value in a optiondict emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - SampleCheckerTwo(self.linter) - - def test_no_level_in_optdict(self) -> None: - """Test that not having a level value in a optiondict emits a DeprecationWarning.""" - with pytest.warns(DeprecationWarning): - SampleCheckerThree(self.linter) diff --git a/tests/config/test_find_default_config_files.py b/tests/config/test_find_default_config_files.py index 2fd66544d..0b513a3d5 100644 --- a/tests/config/test_find_default_config_files.py +++ b/tests/config/test_find_default_config_files.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -130,6 +130,47 @@ def test_pylintrc_parentdir() -> None: @pytest.mark.usefixtures("pop_pylintrc") +def test_pyproject_toml_parentdir() -> None: + """Test the search of pyproject.toml file in parent directories""" + with tempdir() as chroot: + with fake_home(): + chroot_path = Path(chroot) + files = [ + "pyproject.toml", + "git/pyproject.toml", + "git/a/pyproject.toml", + "git/a/.git", + "git/a/b/c/__init__.py", + "hg/pyproject.toml", + "hg/a/pyproject.toml", + "hg/a/.hg", + "hg/a/b/c/__init__.py", + "none/sub/__init__.py", + ] + testutils.create_files(files) + for config_file in files: + if config_file.endswith("pyproject.toml"): + with open(config_file, "w", encoding="utf-8") as fd: + fd.write('[tool.pylint."messages control"]\n') + results = { + "": chroot_path / "pyproject.toml", + "git": chroot_path / "git" / "pyproject.toml", + "git/a": chroot_path / "git" / "a" / "pyproject.toml", + "git/a/b": chroot_path / "git" / "a" / "pyproject.toml", + "git/a/b/c": chroot_path / "git" / "a" / "pyproject.toml", + "hg": chroot_path / "hg" / "pyproject.toml", + "hg/a": chroot_path / "hg" / "a" / "pyproject.toml", + "hg/a/b": chroot_path / "hg" / "a" / "pyproject.toml", + "hg/a/b/c": chroot_path / "hg" / "a" / "pyproject.toml", + "none": chroot_path / "pyproject.toml", + "none/sub": chroot_path / "pyproject.toml", + } + for basedir, expected in results.items(): + os.chdir(chroot_path / basedir) + assert next(config.find_default_config_files(), None) == expected + + +@pytest.mark.usefixtures("pop_pylintrc") def test_pylintrc_parentdir_no_package() -> None: """Test that we don't find a pylintrc in sub-packages.""" with tempdir() as chroot: @@ -138,8 +179,6 @@ def test_pylintrc_parentdir_no_package() -> None: testutils.create_files( ["a/pylintrc", "a/b/pylintrc", "a/b/c/d/__init__.py"] ) - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() is None results = { "a": chroot_path / "a" / "pylintrc", "a/b": chroot_path / "a" / "b" / "pylintrc", @@ -244,7 +283,7 @@ def test_cfg_has_config(content: str, expected: bool, tmp_path: Path) -> None: def test_non_existent_home() -> None: """Test that we handle a non-existent home directory. - Reported in https://github.com/PyCQA/pylint/issues/6802. + Reported in https://github.com/pylint-dev/pylint/issues/6802. """ with mock.patch("pathlib.Path.home", side_effect=RuntimeError): current_dir = os.getcwd() @@ -258,7 +297,7 @@ def test_non_existent_home() -> None: def test_permission_error() -> None: """Test that we handle PermissionError correctly in find_default_config_files. - Reported in https://github.com/PyCQA/pylint/issues/7169. + Reported in https://github.com/pylint-dev/pylint/issues/7169. """ with mock.patch("pathlib.Path.is_file", side_effect=PermissionError): list(config.find_default_config_files()) diff --git a/tests/config/test_functional_config_loading.py b/tests/config/test_functional_config_loading.py index d5a2ba7ca..0bbfe50ff 100644 --- a/tests/config/test_functional_config_loading.py +++ b/tests/config/test_functional_config_loading.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """This launches the configuration functional tests. This permits to test configuration files by providing a file with the appropriate extension in the ``tests/config/functional`` diff --git a/tests/config/test_per_directory_config.py b/tests/config/test_per_directory_config.py index 85d918a21..b888dd405 100644 --- a/tests/config/test_per_directory_config.py +++ b/tests/config/test_per_directory_config.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pathlib import Path diff --git a/tests/config/unittest_config.py b/tests/config/unittest_config.py deleted file mode 100644 index 343663602..000000000 --- a/tests/config/unittest_config.py +++ /dev/null @@ -1,88 +0,0 @@ -# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt - -"""Unit tests for the config module.""" - -from __future__ import annotations - -import re - -import pytest - -from pylint import config -from pylint.checkers import BaseChecker -from pylint.testutils import CheckerTestCase, set_config -from pylint.typing import MessageDefinitionTuple - - -def test__regexp_validator_valid() -> None: - result = config.option._regexp_validator(None, "", "test_.*") - assert isinstance(result, re.Pattern) - assert result.pattern == "test_.*" - - -def test__regexp_validator_invalid() -> None: - with pytest.raises(re.error): - config.option._regexp_validator(None, "", "test_)") - - -def test__csv_validator_no_spaces() -> None: - values = ["One", "Two", "Three"] - result = config.option._csv_validator(None, "", ",".join(values)) - assert isinstance(result, list) - assert len(result) == 3 - for i, value in enumerate(values): - assert result[i] == value - - -def test__csv_validator_spaces() -> None: - values = ["One", "Two", "Three"] - result = config.option._csv_validator(None, "", ", ".join(values)) - assert isinstance(result, list) - assert len(result) == 3 - for i, value in enumerate(values): - assert result[i] == value - - -def test__regexp_csv_validator_valid() -> None: - pattern_strings = ["test_.*", "foo\\.bar", "^baz$"] - result = config.option._regexp_csv_validator(None, "", ",".join(pattern_strings)) - for i, regex in enumerate(result): - assert isinstance(regex, re.Pattern) - assert regex.pattern == pattern_strings[i] - - -def test__regexp_csv_validator_invalid() -> None: - pattern_strings = ["test_.*", "foo\\.bar", "^baz)$"] - with pytest.raises(re.error): - config.option._regexp_csv_validator(None, "", ",".join(pattern_strings)) - - -class TestPyLinterOptionSetters(CheckerTestCase): - """Class to check the set_config decorator for options declared in PyLinter.""" - - class Checker(BaseChecker): - name = "checker" - msgs: dict[str, MessageDefinitionTuple] = {} - options = (("test-opt", {"action": "store_true", "help": "help message"}),) - - CHECKER_CLASS: type = Checker - - @set_config(ignore_paths=".*/tests/.*,.*\\ignore\\.*") - def test_ignore_paths_with_value(self) -> None: - """Test ignore-paths option with value.""" - options = self.linter.config.ignore_paths - - assert any(i.match("dir/tests/file.py") for i in options) - assert any(i.match("dir\\tests\\file.py") for i in options) - assert any(i.match("dir/ignore/file.py") for i in options) - assert any(i.match("dir\\ignore\\file.py") for i in options) - - def test_ignore_paths_with_no_value(self) -> None: - """Test ignore-paths option with no value. - Compare against actual list to see if validator works. - """ - options = self.linter.config.ignore_paths - - assert options == [] diff --git a/tests/conftest.py b/tests/conftest.py index a35e5cc14..a2512b414 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name @@ -85,12 +85,6 @@ def pytest_addoption(parser: pytest.Parser) -> None: help="Run primer stdlib tests", ) parser.addoption( - "--primer-external", - action="store_true", - default=False, - help="Run primer external tests", - ) - parser.addoption( "--minimal-messages-config", action="store_true", default=False, @@ -107,15 +101,6 @@ def pytest_collection_modifyitems( config: pytest.Config, items: list[pytest.Function] ) -> None: """Convert command line options to markers.""" - # Add skip_primer_external mark - if not config.getoption("--primer-external"): - skip_primer_external = pytest.mark.skip( - reason="need --primer-external option to run" - ) - for item in items: - if "primer_external_batch_one" in item.keywords: - item.add_marker(skip_primer_external) - # Add skip_primer_stdlib mark if not config.getoption("--primer-stdlib"): skip_primer_stdlib = pytest.mark.skip( diff --git a/tests/data/clientmodule_test.py b/tests/data/clientmodule_test.py index 35c39684b..7f7c83f46 100644 --- a/tests/data/clientmodule_test.py +++ b/tests/data/clientmodule_test.py @@ -3,7 +3,6 @@ from data.suppliermodule_test import Interface, DoNothing, DoNothing2 class Ancestor: """ Ancestor method """ - __implements__ = (Interface,) cls_member = DoNothing() def __init__(self, value): diff --git a/tests/extensions/__init__.py b/tests/extensions/__init__.py index e8a8ff79f..cfd18ddd3 100644 --- a/tests/extensions/__init__.py +++ b/tests/extensions/__init__.py @@ -1,3 +1,3 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt diff --git a/tests/extensions/test_check_docs_utils.py b/tests/extensions/test_check_docs_utils.py index 692c14859..a0902b673 100644 --- a/tests/extensions/test_check_docs_utils.py +++ b/tests/extensions/test_check_docs_utils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unit tests for utils functions in :mod:`pylint.extensions._check_docs_utils`.""" diff --git a/tests/extensions/test_private_import.py b/tests/extensions/test_private_import.py index c82f51a42..a10384eac 100644 --- a/tests/extensions/test_private_import.py +++ b/tests/extensions/test_private_import.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Tests the local module directory comparison logic which requires mocking file directories""" diff --git a/tests/functional/a/access/access_to_protected_members.py b/tests/functional/a/access/access_to_protected_members.py index 9ca221628..334ec6a24 100644 --- a/tests/functional/a/access/access_to_protected_members.py +++ b/tests/functional/a/access/access_to_protected_members.py @@ -215,7 +215,7 @@ class Issue1159Subclass(Issue1159): class Issue3066: """Test for GitHub issue 3066 Accessing of attributes/methods of inner and outer classes - https://github.com/PyCQA/pylint/issues/3066""" + https://github.com/pylint-dev/pylint/issues/3066""" attr = 0 _attr = 1 diff --git a/tests/functional/a/alternative/alternative_union_syntax_error.py b/tests/functional/a/alternative/alternative_union_syntax_error.py index d998b7f00..5730e2e50 100644 --- a/tests/functional/a/alternative/alternative_union_syntax_error.py +++ b/tests/functional/a/alternative/alternative_union_syntax_error.py @@ -10,7 +10,7 @@ Testing only 3.8/3.9 to support TypedDict. # pylint: disable=unnecessary-lambda-assignment # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import dataclasses diff --git a/tests/functional/a/alternative/alternative_union_syntax_py37.py b/tests/functional/a/alternative/alternative_union_syntax_py37.py index 41eb75ec6..b82a45153 100644 --- a/tests/functional/a/alternative/alternative_union_syntax_py37.py +++ b/tests/functional/a/alternative/alternative_union_syntax_py37.py @@ -9,7 +9,7 @@ Testing only 3.8/3.9 to support TypedDict. # pylint: disable=inherit-non-class,too-few-public-methods,line-too-long,unnecessary-direct-lambda-call # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from __future__ import annotations diff --git a/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py b/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py index 8ec199958..6859e65a7 100644 --- a/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py +++ b/tests/functional/a/alternative/alternative_union_syntax_regession_8119.py @@ -2,7 +2,7 @@ Syntax support was added in Python 3.10. The code snipped should not raise any errors. -https://github.com/PyCQA/pylint/issues/8119 +https://github.com/pylint-dev/pylint/issues/8119 """ # pylint: disable=missing-docstring,too-few-public-methods from typing import Generic, TypeVar diff --git a/tests/functional/a/arguments.py b/tests/functional/a/arguments.py index 6929b9850..29fdbd5ba 100644 --- a/tests/functional/a/arguments.py +++ b/tests/functional/a/arguments.py @@ -265,7 +265,7 @@ CALL = lambda *args: func(*args) # Ensure `too-many-function-args` is not emitted when a function call is assigned # to a class attribute inside the class where the function is defined. -# Reference: https://github.com/PyCQA/pylint/issues/6592 +# Reference: https://github.com/pylint-dev/pylint/issues/6592 class FruitPicker: def _pick_fruit(fruit): def _print_selection(self): diff --git a/tests/functional/a/arguments_differ.py b/tests/functional/a/arguments_differ.py index f579f89a6..65e953d76 100644 --- a/tests/functional/a/arguments_differ.py +++ b/tests/functional/a/arguments_differ.py @@ -246,7 +246,7 @@ class ChildClass(ParentClass): pass
-# https://github.com/PyCQA/pylint/issues/4443
+# https://github.com/pylint-dev/pylint/issues/4443
# Some valid overwrites with type annotations
import typing # pylint: disable=wrong-import-position
@@ -331,8 +331,8 @@ class Foo2(AbstractFoo): # Adding arguments with default values to a child class is valid
# See:
-# https://github.com/PyCQA/pylint/issues/1556
-# https://github.com/PyCQA/pylint/issues/5338
+# https://github.com/pylint-dev/pylint/issues/1556
+# https://github.com/pylint-dev/pylint/issues/5338
class BaseClass:
diff --git a/tests/functional/a/arguments_differ_issue5371.py b/tests/functional/a/arguments_differ_issue5371.py index a0cd39613..a93302fb8 100644 --- a/tests/functional/a/arguments_differ_issue5371.py +++ b/tests/functional/a/arguments_differ_issue5371.py @@ -1,4 +1,4 @@ -"""https://github.com/PyCQA/pylint/issues/5371""" +"""https://github.com/pylint-dev/pylint/issues/5371""" from enum import Enum diff --git a/tests/functional/a/arguments_positional_only.py b/tests/functional/a/arguments_positional_only.py new file mode 100644 index 000000000..eb03f1803 --- /dev/null +++ b/tests/functional/a/arguments_positional_only.py @@ -0,0 +1,15 @@ +"""Test `no-value-for-parameter` in the context of positional-only parameters""" + +# pylint: disable=missing-docstring, unused-argument + + +def name1(param1, /, **kwargs): ... +def name2(param1, /, param2, **kwargs): ... +def name3(param1=True, /, **kwargs): ... +def name4(param1, **kwargs): ... + +name1(param1=43) # [no-value-for-parameter] +name1(43) +name2(1, param2=False) +name3() +name4(param1=43) diff --git a/tests/functional/s/singledispatch_method_py38.rc b/tests/functional/a/arguments_positional_only.rc index 85fc502b3..85fc502b3 100644 --- a/tests/functional/s/singledispatch_method_py38.rc +++ b/tests/functional/a/arguments_positional_only.rc diff --git a/tests/functional/a/arguments_positional_only.txt b/tests/functional/a/arguments_positional_only.txt new file mode 100644 index 000000000..7112e6880 --- /dev/null +++ b/tests/functional/a/arguments_positional_only.txt @@ -0,0 +1 @@ +no-value-for-parameter:11:0:11:16::No value for argument 'param1' in function call:UNDEFINED diff --git a/tests/functional/a/arguments_renamed.py b/tests/functional/a/arguments_renamed.py index 73105f824..9b120f474 100644 --- a/tests/functional/a/arguments_renamed.py +++ b/tests/functional/a/arguments_renamed.py @@ -74,7 +74,7 @@ class ChildDefaults(ParentDefaults): print(f"arguments: {arg2}") # Check for crash on method definitions not at top level of class -# https://github.com/PyCQA/pylint/issues/5648 +# https://github.com/pylint-dev/pylint/issues/5648 class FruitConditional: define_eat = True diff --git a/tests/functional/a/assigning/assigning_non_slot.py b/tests/functional/a/assigning/assigning_non_slot.py index 7b4322e62..e27af79ac 100644 --- a/tests/functional/a/assigning/assigning_non_slot.py +++ b/tests/functional/a/assigning/assigning_non_slot.py @@ -226,7 +226,7 @@ class MyDescriptor: pass -# Regression test from https://github.com/PyCQA/pylint/issues/6001 +# Regression test from https://github.com/pylint-dev/pylint/issues/6001 class Base: __slots__ = () diff --git a/tests/functional/a/assigning/assigning_non_slot_4509.py b/tests/functional/a/assigning/assigning_non_slot_4509.py index 797c6b083..bb1cde6de 100644 --- a/tests/functional/a/assigning/assigning_non_slot_4509.py +++ b/tests/functional/a/assigning/assigning_non_slot_4509.py @@ -1,8 +1,8 @@ # pylint: disable=invalid-name,missing-docstring,too-few-public-methods # Slots with base that inherits from 'Generic' -# https://github.com/PyCQA/pylint/issues/4509 -# https://github.com/PyCQA/astroid/issues/999 +# https://github.com/pylint-dev/pylint/issues/4509 +# https://github.com/pylint-dev/astroid/issues/999 from typing import Generic, TypeVar T = TypeVar("T") diff --git a/tests/functional/a/assignment/assignment_expression.py b/tests/functional/a/assignment/assignment_expression.py index 0df18f3d6..bf6f8ebf0 100644 --- a/tests/functional/a/assignment/assignment_expression.py +++ b/tests/functional/a/assignment/assignment_expression.py @@ -28,11 +28,11 @@ values = ( ) -# https://github.com/PyCQA/pylint/issues/3347 +# https://github.com/pylint-dev/pylint/issues/3347 s = 'foo' if (fval := lambda: 1) is None else fval -# https://github.com/PyCQA/pylint/issues/3953 +# https://github.com/pylint-dev/pylint/issues/3953 assert (n := 2) == 1, f"Expected 1, but got {n}" dict({1: (o := 2)}, data=o) assert (p := 2) == 1, \ @@ -42,7 +42,7 @@ FOO_PATT = re.compile("") foo = m.group("foo") if (m := FOO_PATT.match("")) else False -# https://github.com/PyCQA/pylint/issues/3865 +# https://github.com/pylint-dev/pylint/issues/3865 if (c := lambda: 2) and c(): print("ok") @@ -50,7 +50,7 @@ def func(): print((d := lambda: 2) and d) -# https://github.com/PyCQA/pylint/issues/3275 +# https://github.com/pylint-dev/pylint/issues/3275 values = ( e := 1, f := e, @@ -64,11 +64,11 @@ function = lambda: ( print(function()) -# https://github.com/PyCQA/pylint/issues/3763 +# https://github.com/pylint-dev/pylint/issues/3763 foo if (foo := 3 - 2) > 0 else 0 -# https://github.com/PyCQA/pylint/issues/4238 +# https://github.com/pylint-dev/pylint/issues/4238 l1 = f'The number {(count1 := 4)} ' \ f'is equal to {count1}' l2: str = ( @@ -82,13 +82,13 @@ l3 += ( ) -# https://github.com/PyCQA/pylint/issues/4301 +# https://github.com/pylint-dev/pylint/issues/4301 def func2(): return f'The number {(count := 4)} ' \ f'is equal to {count}' -# https://github.com/PyCQA/pylint/issues/4828 +# https://github.com/pylint-dev/pylint/issues/4828 def func3(): return bar if (bar := "") else "" @@ -99,7 +99,7 @@ def func4(): # Crash related to assignment expression in nested if statements -# See https://github.com/PyCQA/pylint/issues/5178 +# See https://github.com/pylint-dev/pylint/issues/5178 def func5(val): variable = None diff --git a/tests/functional/a/assignment/assignment_from_no_return.py b/tests/functional/a/assignment/assignment_from_no_return.py index 673e5e467..7084beb2f 100644 --- a/tests/functional/a/assignment/assignment_from_no_return.py +++ b/tests/functional/a/assignment/assignment_from_no_return.py @@ -55,7 +55,7 @@ class Child(Parent): return 42 -# Regression test for https://github.com/PyCQA/pylint/issues/4220 +# Regression test for https://github.com/pylint-dev/pylint/issues/4220 class A: """Parent class""" def f(self): diff --git a/tests/functional/b/bad_option_value.txt b/tests/functional/b/bad_option_value.txt index ce7605691..51af412f7 100644 --- a/tests/functional/b/bad_option_value.txt +++ b/tests/functional/b/bad_option_value.txt @@ -1,17 +1,17 @@ unknown-option-value:4:0:None:None::Unknown option value for 'disable', expected a valid pylint message and got 'C05048':HIGH -useless-option-value:6:0:None:None::"Useless option value for 'disable', 'execfile-builtin' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH +useless-option-value:6:0:None:None::"Useless option value for 'disable', 'execfile-builtin' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH useless-option-value:8:0:None:None::"Useless option value for 'disable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH -useless-option-value:10:0:None:None::"Useless option value for 'disable', 'W1656' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH +useless-option-value:10:0:None:None::"Useless option value for 'disable', 'W1656' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH useless-option-value:12:0:None:None::"Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH unknown-option-value:14:0:None:None::Unknown option value for 'disable-next', expected a valid pylint message and got 'R78948':HIGH -useless-option-value:16:0:None:None::"Useless option value for 'disable-next', 'deprecated-types-field' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH -useless-option-value:18:0:None:None::"Useless option value for 'disable-next', 'W1634' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH +useless-option-value:16:0:None:None::"Useless option value for 'disable-next', 'deprecated-types-field' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH +useless-option-value:18:0:None:None::"Useless option value for 'disable-next', 'W1634' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH useless-option-value:20:0:None:None::"Useless option value for 'disable-next', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH useless-option-value:22:0:None:None::"Useless option value for 'disable-next', 'R0201' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH unknown-option-value:25:0:None:None::Unknown option value for 'enable', expected a valid pylint message and got 'W04044':HIGH -useless-option-value:27:0:None:None::"Useless option value for 'enable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH +useless-option-value:27:0:None:None::"Useless option value for 'enable', 'dict-values-not-iterating' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH useless-option-value:29:0:None:None::"Useless option value for 'enable', 'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH -useless-option-value:31:0:None:None::"Useless option value for 'enable', 'W1622' was removed from pylint, see https://github.com/PyCQA/pylint/pull/4942.":HIGH +useless-option-value:31:0:None:None::"Useless option value for 'enable', 'W1622' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/4942.":HIGH useless-option-value:33:0:None:None::"Useless option value for 'enable', 'R0201' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers.":HIGH -useless-option-value:36:0:None:None::"Useless option value for 'disable', 'no-space-after-operator' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3577.":HIGH -useless-option-value:38:0:None:None::"Useless option value for 'disable', 'C0323' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3577.":HIGH +useless-option-value:36:0:None:None::"Useless option value for 'disable', 'no-space-after-operator' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/3577.":HIGH +useless-option-value:38:0:None:None::"Useless option value for 'disable', 'C0323' was removed from pylint, see https://github.com/pylint-dev/pylint/pull/3577.":HIGH diff --git a/tests/functional/b/bad_reversed_sequence_py37.py b/tests/functional/b/bad_reversed_sequence_py37.py index 5a0b2124c..4f132d945 100644 --- a/tests/functional/b/bad_reversed_sequence_py37.py +++ b/tests/functional/b/bad_reversed_sequence_py37.py @@ -1,8 +1,8 @@ """ Dictionaries are reversible starting on python 3.8""" - # pylint: disable=missing-docstring -reversed({'a': 1, 'b': 2}) # [bad-reversed-sequence] +# This can't be detected since changes to locals aren't backported +reversed({'a': 1, 'b': 2}) class InheritDict(dict): diff --git a/tests/functional/b/bad_reversed_sequence_py37.rc b/tests/functional/b/bad_reversed_sequence_py37.rc index 67a28a36a..77eb3be64 100644 --- a/tests/functional/b/bad_reversed_sequence_py37.rc +++ b/tests/functional/b/bad_reversed_sequence_py37.rc @@ -1,2 +1,2 @@ -[testoptions] -max_pyver=3.8 +[main] +py-version=3.7 diff --git a/tests/functional/b/bad_reversed_sequence_py37.txt b/tests/functional/b/bad_reversed_sequence_py37.txt index 6fbbd2c59..da511347b 100644 --- a/tests/functional/b/bad_reversed_sequence_py37.txt +++ b/tests/functional/b/bad_reversed_sequence_py37.txt @@ -1,2 +1 @@ -bad-reversed-sequence:5:0:5:26::The first reversed() argument is not a sequence:UNDEFINED bad-reversed-sequence:12:0:12:39::The first reversed() argument is not a sequence:UNDEFINED diff --git a/tests/functional/c/cached_property.py b/tests/functional/c/cached_property.py index 0b75f246b..85d271ab5 100644 --- a/tests/functional/c/cached_property.py +++ b/tests/functional/c/cached_property.py @@ -2,7 +2,7 @@ from functools import cached_property -# https://github.com/PyCQA/pylint/issues/4023 +# https://github.com/pylint-dev/pylint/issues/4023 # False-positive 'invalid-overridden-method' with 'cached_property' class Parent: @property diff --git a/tests/functional/c/cellvar_escaping_loop.py b/tests/functional/c/cellvar_escaping_loop.py index 8781e6c5c..eb120ea79 100644 --- a/tests/functional/c/cellvar_escaping_loop.py +++ b/tests/functional/c/cellvar_escaping_loop.py @@ -95,7 +95,7 @@ def good_case_issue3107(): def good_case_issue_5012(): """Eager binding of cell variable when used as the default value of a keyword-only argument. - https://github.com/PyCQA/pylint/issues/5012 + https://github.com/pylint-dev/pylint/issues/5012 """ funs = [] for i in range(5): diff --git a/tests/functional/c/class_protocol_ellipsis.py b/tests/functional/c/class_protocol_ellipsis.py index ef5d3b34e..a6c0b0677 100644 --- a/tests/functional/c/class_protocol_ellipsis.py +++ b/tests/functional/c/class_protocol_ellipsis.py @@ -5,7 +5,7 @@ from typing import Any, Iterator class MyClass: """The "invalid-*-returned" messages shouldn't be emitted for stub functions - Original issue: https://github.com/PyCQA/pylint/issues/4736""" + Original issue: https://github.com/pylint-dev/pylint/issues/4736""" def __len__(self) -> int: ... diff --git a/tests/functional/c/comparison_with_callable_typing_constants.py b/tests/functional/c/comparison_with_callable_typing_constants.py index 70aa9763f..487edc80f 100644 --- a/tests/functional/c/comparison_with_callable_typing_constants.py +++ b/tests/functional/c/comparison_with_callable_typing_constants.py @@ -6,7 +6,7 @@ from typing import Any, Optional def check_any(type_) -> bool: - """See https://github.com/PyCQA/pylint/issues/5557""" + """See https://github.com/pylint-dev/pylint/issues/5557""" return type_ == Any diff --git a/tests/functional/c/consider/consider_iterating_dictionary.py b/tests/functional/c/consider/consider_iterating_dictionary.py index 91402bf77..507e7c0c9 100644 --- a/tests/functional/c/consider/consider_iterating_dictionary.py +++ b/tests/functional/c/consider/consider_iterating_dictionary.py @@ -68,7 +68,7 @@ VAR = 1 in dict() VAR = [1, 2] == {}.keys() in {False} # Additional membership checks -# See: https://github.com/PyCQA/pylint/issues/5323 +# See: https://github.com/pylint-dev/pylint/issues/5323 metadata = {} if "a" not in list(metadata.keys()): # [consider-iterating-dictionary] print(1) diff --git a/tests/functional/c/consider/consider_using_dict_items.py b/tests/functional/c/consider/consider_using_dict_items.py index 7ffea608f..7fd74814f 100644 --- a/tests/functional/c/consider/consider_using_dict_items.py +++ b/tests/functional/c/consider/consider_using_dict_items.py @@ -86,7 +86,7 @@ val = any(True for k8 in Foo.c_dict if c_dict[k8]) val = any(True for k8 in Foo.c_dict.keys() if Foo.c_dict[k8]) # [consider-iterating-dictionary,consider-using-dict-items]
# Test false positive described in #4630
-# (https://github.com/PyCQA/pylint/issues/4630)
+# (https://github.com/pylint-dev/pylint/issues/4630)
d = {'key': 'value'}
diff --git a/tests/functional/c/consider/consider_using_enumerate.py b/tests/functional/c/consider/consider_using_enumerate.py index 352669f6a..1b8bb4c6b 100644 --- a/tests/functional/c/consider/consider_using_enumerate.py +++ b/tests/functional/c/consider/consider_using_enumerate.py @@ -73,7 +73,7 @@ def does_not_crash_on_range_without_args(): print(elem)
# False negative described in #3657
-# https://github.com/PyCQA/pylint/issues/3657
+# https://github.com/pylint-dev/pylint/issues/3657
class MyClass:
def __init__(self):
self.my_list = []
diff --git a/tests/functional/c/consider/consider_using_f_string.py b/tests/functional/c/consider/consider_using_f_string.py index e961c44f7..e0a4831cf 100644 --- a/tests/functional/c/consider/consider_using_f_string.py +++ b/tests/functional/c/consider/consider_using_f_string.py @@ -1,4 +1,4 @@ -"""Test to see if a f-string would be possible and consider-using-f-string should be raised""" +"""Test to see if an f-string would be possible and consider-using-f-string should be raised""" # pylint: disable=unused-variable, invalid-name, missing-function-docstring, pointless-statement # pylint: disable=expression-not-assigned, repeated-keyword, too-many-locals diff --git a/tests/functional/c/consider/consider_using_f_string.txt b/tests/functional/c/consider/consider_using_f_string.txt index 1d68e947b..e7785bae6 100644 --- a/tests/functional/c/consider/consider_using_f_string.txt +++ b/tests/functional/c/consider/consider_using_f_string.txt @@ -1,30 +1,30 @@ -consider-using-f-string:45:10:45:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:46:10:46:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:47:10:47:28:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:48:10:48:17:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:49:10:49:26:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:50:10:50:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:51:10:51:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:52:10:52:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:53:10:53:24:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:54:10:54:21:print_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:80:4:80:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:81:4:81:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:82:4:82:22:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:83:4:83:11:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:84:4:84:20:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:85:4:85:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:86:4:86:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:87:4:87:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:88:4:88:18:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:89:4:89:15:statement_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:112:8:112:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:113:8:113:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:114:8:114:26:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:115:8:115:15:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:116:8:116:24:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:117:8:117:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:118:8:118:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:119:8:119:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:120:8:120:22:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED -consider-using-f-string:121:8:121:19:assignment_bad:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:45:10:45:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:46:10:46:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:47:10:47:28:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:48:10:48:17:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:49:10:49:26:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:50:10:50:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:51:10:51:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:52:10:52:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:53:10:53:24:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:54:10:54:21:print_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:80:4:80:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:81:4:81:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:82:4:82:22:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:83:4:83:11:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:84:4:84:20:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:85:4:85:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:86:4:86:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:87:4:87:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:88:4:88:18:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:89:4:89:15:statement_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:112:8:112:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:113:8:113:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:114:8:114:26:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:115:8:115:15:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:116:8:116:24:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:117:8:117:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:118:8:118:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:119:8:119:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:120:8:120:22:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED +consider-using-f-string:121:8:121:19:assignment_bad:Formatting a regular string which could be an f-string:UNDEFINED diff --git a/tests/functional/c/consider/consider_using_generator.py b/tests/functional/c/consider/consider_using_generator.py index ee561a7e9..af5700373 100644 --- a/tests/functional/c/consider/consider_using_generator.py +++ b/tests/functional/c/consider/consider_using_generator.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring, invalid-name -# https://github.com/PyCQA/pylint/issues/3165 +# https://github.com/pylint-dev/pylint/issues/3165 list([]) tuple([]) diff --git a/tests/functional/c/consider/consider_using_min_max_builtin.py b/tests/functional/c/consider/consider_using_min_max_builtin.py index 6e7c7b886..e33394c47 100644 --- a/tests/functional/c/consider/consider_using_min_max_builtin.py +++ b/tests/functional/c/consider/consider_using_min_max_builtin.py @@ -97,7 +97,7 @@ else: value = 3 -# https://github.com/PyCQA/pylint/issues/4379 +# https://github.com/pylint-dev/pylint/issues/4379 var = 1 if var == -1: var = None diff --git a/tests/functional/c/consider/consider_using_with.py b/tests/functional/c/consider/consider_using_with.py index 1c87582ee..e8e162337 100644 --- a/tests/functional/c/consider/consider_using_with.py +++ b/tests/functional/c/consider/consider_using_with.py @@ -230,7 +230,7 @@ with used_pool: def test_subscript_assignment(): """ - Regression test for issue https://github.com/PyCQA/pylint/issues/4732. + Regression test for issue https://github.com/pylint-dev/pylint/issues/4732. If a context manager is assigned to a list or dict, we are not able to tell if / how the context manager is used later on, as it is not assigned to a variable or attribute directly. diff --git a/tests/functional/d/dataclass/dataclass_typecheck.py b/tests/functional/d/dataclass/dataclass_typecheck.py index fbd770704..e66755640 100644 --- a/tests/functional/d/dataclass/dataclass_typecheck.py +++ b/tests/functional/d/dataclass/dataclass_typecheck.py @@ -1,12 +1,12 @@ """Tests for dataclass attributes with basic type annotations. -Tests for regressions from https://github.com/PyCQA/astroid/pull/1126 +Tests for regressions from https://github.com/pylint-dev/astroid/pull/1126 """ # pylint: disable=missing-docstring,too-few-public-methods,pointless-statement,redefined-builtin, fixme # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from dataclasses import dataclass diff --git a/tests/functional/d/dataclass/dataclass_with_default_factory.py b/tests/functional/d/dataclass/dataclass_with_default_factory.py index db392d8b7..809c3304b 100644 --- a/tests/functional/d/dataclass/dataclass_with_default_factory.py +++ b/tests/functional/d/dataclass/dataclass_with_default_factory.py @@ -1,7 +1,7 @@ """Various regression tests for dataclasses.""" # See issues: -# - https://github.com/PyCQA/pylint/issues/2605 -# - https://github.com/PyCQA/pylint/issues/2698 +# - https://github.com/pylint-dev/pylint/issues/2605 +# - https://github.com/pylint-dev/pylint/issues/2698 from dataclasses import dataclass, field import dataclasses as dc from typing import cast diff --git a/tests/functional/d/dataclass/dataclass_with_field.py b/tests/functional/d/dataclass/dataclass_with_field.py index 9a807becb..04a186c72 100644 --- a/tests/functional/d/dataclass/dataclass_with_field.py +++ b/tests/functional/d/dataclass/dataclass_with_field.py @@ -1,4 +1,4 @@ -"""Regression test for https://github.com/PyCQA/pylint/issues/4899""" +"""Regression test for https://github.com/pylint-dev/pylint/issues/4899""" # pylint: disable=missing-docstring,too-few-public-methods diff --git a/tests/functional/d/disabled_msgid_in_pylintrc.py b/tests/functional/d/disabled_msgid_in_pylintrc.py index 91cb155e1..7ad701de9 100644 --- a/tests/functional/d/disabled_msgid_in_pylintrc.py +++ b/tests/functional/d/disabled_msgid_in_pylintrc.py @@ -1,4 +1,4 @@ -"""https://github.com/PyCQA/pylint/issues/4265""" +"""https://github.com/pylint-dev/pylint/issues/4265""" try: f = open('test', encoding="utf-8") diff --git a/tests/functional/e/.#emacs_file_lock.py b/tests/functional/e/.#emacs_file_lock.py index e2ed09d7c..a21e28482 100644 --- a/tests/functional/e/.#emacs_file_lock.py +++ b/tests/functional/e/.#emacs_file_lock.py @@ -1,4 +1,4 @@ # The name is invalid, but we should not analyse this file # Because its filename reseambles an Emacs file lock ignored by default # https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html -# See https://github.com/PyCQA/pylint/issues/367 +# See https://github.com/pylint-dev/pylint/issues/367 diff --git a/tests/functional/e/.#emacs_file_lock_by_conf.py b/tests/functional/e/.#emacs_file_lock_by_conf.py index a7247f609..af875582c 100644 --- a/tests/functional/e/.#emacs_file_lock_by_conf.py +++ b/tests/functional/e/.#emacs_file_lock_by_conf.py @@ -1,3 +1,3 @@ # The name is invalid, but we should not analyse this file # Because it resembles an Emacs file lock and is ignored by the configuration -# See https://github.com/PyCQA/pylint/issues/367 +# See https://github.com/pylint-dev/pylint/issues/367 diff --git a/tests/functional/e/enum_self_defined_member_5138.py b/tests/functional/e/enum_self_defined_member_5138.py index 4a49903c6..d9a6c105e 100644 --- a/tests/functional/e/enum_self_defined_member_5138.py +++ b/tests/functional/e/enum_self_defined_member_5138.py @@ -1,4 +1,4 @@ -"""Tests for self-defined Enum members (https://github.com/PyCQA/pylint/issues/5138)""" +"""Tests for self-defined Enum members (https://github.com/pylint-dev/pylint/issues/5138)""" # pylint: disable=missing-docstring from enum import IntEnum, Enum diff --git a/tests/functional/e/enum_self_defined_member_6805.py b/tests/functional/e/enum_self_defined_member_6805.py index bcf0c8e10..1b70bbe82 100644 --- a/tests/functional/e/enum_self_defined_member_6805.py +++ b/tests/functional/e/enum_self_defined_member_6805.py @@ -1,4 +1,4 @@ -"""Tests for self-defined Enum members (https://github.com/PyCQA/pylint/issues/6805)""" +"""Tests for self-defined Enum members (https://github.com/pylint-dev/pylint/issues/6805)""" # pylint: disable=missing-docstring # pylint: disable=too-few-public-methods from enum import IntEnum diff --git a/tests/functional/e/enum_subclasses.py b/tests/functional/e/enum_subclasses.py index 6ad453a4b..eb6e1bebb 100644 --- a/tests/functional/e/enum_subclasses.py +++ b/tests/functional/e/enum_subclasses.py @@ -3,7 +3,7 @@ from enum import Enum, Flag, IntEnum, auto class Issue1932(IntEnum): - """https://github.com/PyCQA/pylint/issues/1932""" + """https://github.com/pylint-dev/pylint/issues/1932""" FOO = 1 @@ -12,7 +12,7 @@ class Issue1932(IntEnum): class Issue2062(Enum): - """https://github.com/PyCQA/pylint/issues/2062""" + """https://github.com/pylint-dev/pylint/issues/2062""" FOO = 1 BAR = 2 @@ -81,7 +81,7 @@ assert test_enum.hello_pylint() == test_enum.name # Check combinations of Flag members using the bitwise operators (&, |, ^, ~) -# https://github.com/PyCQA/pylint/issues/7381 +# https://github.com/pylint-dev/pylint/issues/7381 class Colour(Flag): NONE = 0 RED = 2 diff --git a/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py b/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py index 417bc5c0b..ab3acfe27 100644 --- a/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py +++ b/tests/functional/ext/code_style/cs_consider_using_augmented_assign.py @@ -121,7 +121,7 @@ x = x <= 3 x = 3 <= x -# https://github.com/PyCQA/pylint/issues/8086 +# https://github.com/pylint-dev/pylint/issues/8086 # consider-using-augmented-assign should only be flagged # if names attribute names match exactly. diff --git a/tests/functional/ext/comparetozero/compare_to_zero.py b/tests/functional/ext/comparetozero/compare_to_zero.py deleted file mode 100644 index 6a14b8bc9..000000000 --- a/tests/functional/ext/comparetozero/compare_to_zero.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=literal-comparison,missing-docstring, singleton-comparison - -X = 123 -Y = len('test') - -if X is 0: # [compare-to-zero] - pass - -if X is False: - pass - -if Y is not 0: # [compare-to-zero] - pass - -if Y is not False: - pass - -if X == 0: # [compare-to-zero] - pass - -if X == False: - pass - -if 0 == Y: # [compare-to-zero] - pass - -if Y != 0: # [compare-to-zero] - pass - -if 0 != X: # [compare-to-zero] - pass - -if Y != False: - pass - -if X > 0: - pass - -if X < 0: - pass - -if 0 < X: - pass - -if 0 > X: - pass diff --git a/tests/functional/ext/comparetozero/compare_to_zero.rc b/tests/functional/ext/comparetozero/compare_to_zero.rc deleted file mode 100644 index 70c6171b5..000000000 --- a/tests/functional/ext/comparetozero/compare_to_zero.rc +++ /dev/null @@ -1,2 +0,0 @@ -[MAIN] -load-plugins=pylint.extensions.comparetozero, diff --git a/tests/functional/ext/comparetozero/compare_to_zero.txt b/tests/functional/ext/comparetozero/compare_to_zero.txt deleted file mode 100644 index a413a3268..000000000 --- a/tests/functional/ext/comparetozero/compare_to_zero.txt +++ /dev/null @@ -1,6 +0,0 @@ -compare-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"" as 0 is falsey":HIGH -compare-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"" as 0 is falsey":HIGH -compare-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"" as 0 is falsey":HIGH -compare-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"" as 0 is falsey":HIGH -compare-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"" as 0 is falsey":HIGH -compare-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"" as 0 is falsey":HIGH diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py index 92646a87f..917841581 100644 --- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py +++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py @@ -12,7 +12,7 @@ https://google.github.io/styleguide/pyguide.html#doc-function-args def test_multi_line_parameters(param: int) -> None: """Checks that multi line parameters lists are checked correctly - See https://github.com/PyCQA/pylint/issues/5452 + See https://github.com/pylint-dev/pylint/issues/5452 Args: param: diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py index 5626ad385..794f4c2f6 100644 --- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py +++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py @@ -394,7 +394,7 @@ def test_ignores_optional_specifier_numpy(param, param2="all"): def test_with_list_of_default_values(arg, option, option2): - """Reported in https://github.com/PyCQA/pylint/issues/4035. + """Reported in https://github.com/pylint-dev/pylint/issues/4035. Parameters ---------- @@ -412,7 +412,7 @@ def test_with_list_of_default_values(arg, option, option2): def test_with_descriptions_instead_of_typing(arg, axis, option): """We choose to accept description in place of typing as well. - See: https://github.com/PyCQA/pylint/pull/7398. + See: https://github.com/pylint-dev/pylint/pull/7398. Parameters ---------- diff --git a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py index a2a2f7c92..36f3aed1f 100644 --- a/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py +++ b/tests/functional/ext/docparams/parameter/missing_param_doc_required_Sphinx.py @@ -220,7 +220,7 @@ def test_finds_args_without_type_sphinx( # [inconsistent-return-statements] ): r"""The Sphinx docstring In Sphinx docstrings asterisks should be escaped. - See https://github.com/PyCQA/pylint/issues/5406 + See https://github.com/pylint-dev/pylint/issues/5406 :param named_arg: Returned :type named_arg: object @@ -239,7 +239,7 @@ def test_finds_kwargs_without_type_sphinx( # [inconsistent-return-statements] ): r"""The Sphinx docstring In Sphinx docstrings asterisks should be escaped. - See https://github.com/PyCQA/pylint/issues/5406 + See https://github.com/pylint-dev/pylint/issues/5406 :param named_arg: Returned :type named_arg: object diff --git a/tests/functional/ext/docparams/raise/missing_raises_doc_options.py b/tests/functional/ext/docparams/raise/missing_raises_doc_options.py index eb3cd3ac3..5f1ef3969 100644 --- a/tests/functional/ext/docparams/raise/missing_raises_doc_options.py +++ b/tests/functional/ext/docparams/raise/missing_raises_doc_options.py @@ -3,7 +3,7 @@ accept-no-raise-doc option is set to True. Requires at least one matching section (`Docstring.matching_sections`). -Taken from https://github.com/PyCQA/pylint/issues/7208 +Taken from https://github.com/pylint-dev/pylint/issues/7208 """ diff --git a/tests/functional/ext/emptystring/empty_string_comparison.py b/tests/functional/ext/emptystring/empty_string_comparison.py deleted file mode 100644 index b61caeff6..000000000 --- a/tests/functional/ext/emptystring/empty_string_comparison.py +++ /dev/null @@ -1,22 +0,0 @@ -# pylint: disable=literal-comparison,missing-docstring - -X = '' -Y = 'test' - -if X is '': # [compare-to-empty-string] - pass - -if Y is not "": # [compare-to-empty-string] - pass - -if X == "": # [compare-to-empty-string] - pass - -if Y != '': # [compare-to-empty-string] - pass - -if "" == Y: # [compare-to-empty-string] - pass - -if '' != X: # [compare-to-empty-string] - pass diff --git a/tests/functional/ext/emptystring/empty_string_comparison.rc b/tests/functional/ext/emptystring/empty_string_comparison.rc deleted file mode 100644 index d2826befa..000000000 --- a/tests/functional/ext/emptystring/empty_string_comparison.rc +++ /dev/null @@ -1,2 +0,0 @@ -[MAIN] -load-plugins=pylint.extensions.emptystring, diff --git a/tests/functional/ext/emptystring/empty_string_comparison.txt b/tests/functional/ext/emptystring/empty_string_comparison.txt deleted file mode 100644 index be9c91bc5..000000000 --- a/tests/functional/ext/emptystring/empty_string_comparison.txt +++ /dev/null @@ -1,6 +0,0 @@ -compare-to-empty-string:6:3:6:10::"""X is ''"" can be simplified to ""not X"" as an empty string is falsey":HIGH -compare-to-empty-string:9:3:9:14::"""Y is not ''"" can be simplified to ""Y"" as an empty string is falsey":HIGH -compare-to-empty-string:12:3:12:10::"""X == ''"" can be simplified to ""not X"" as an empty string is falsey":HIGH -compare-to-empty-string:15:3:15:10::"""Y != ''"" can be simplified to ""Y"" as an empty string is falsey":HIGH -compare-to-empty-string:18:3:18:10::"""'' == Y"" can be simplified to ""not Y"" as an empty string is falsey":HIGH -compare-to-empty-string:21:3:21:10::"""'' != X"" can be simplified to ""X"" as an empty string is falsey":HIGH diff --git a/tests/functional/ext/for_any_all/for_any_all.py b/tests/functional/ext/for_any_all/for_any_all.py index 649739c37..fb09e491b 100644 --- a/tests/functional/ext/for_any_all/for_any_all.py +++ b/tests/functional/ext/for_any_all/for_any_all.py @@ -147,7 +147,7 @@ def is_from_decorator(node): return False def optimized_any_with_break(split_lines, max_chars): - """False negative found in https://github.com/PyCQA/pylint/pull/7697""" + """False negative found in https://github.com/pylint-dev/pylint/pull/7697""" potential_line_length_warning = False for line in split_lines: # [consider-using-any-or-all] if len(line) > max_chars: diff --git a/tests/functional/ext/redefined_loop_name/redefined_loop_name.py b/tests/functional/ext/redefined_loop_name/redefined_loop_name.py index 0af49f9bf..ed4efcffe 100644 --- a/tests/functional/ext/redefined_loop_name/redefined_loop_name.py +++ b/tests/functional/ext/redefined_loop_name/redefined_loop_name.py @@ -1,6 +1,6 @@ """Tests for redefinitions of loop variables inside the loop body. -See: https://github.com/PyCQA/pylint/issues/5608 +See: https://github.com/pylint-dev/pylint/issues/5608 """ # pylint: disable=invalid-name diff --git a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py index 1d31bc968..e642ad520 100644 --- a/tests/functional/ext/redefined_variable_type/redefined_variable_type.py +++ b/tests/functional/ext/redefined_variable_type/redefined_variable_type.py @@ -86,7 +86,7 @@ def func2(x): # Test that ``redefined-variable-type`` is not emitted -# https://github.com/PyCQA/pylint/issues/8120 +# https://github.com/pylint-dev/pylint/issues/8120 async def test_a(): data = [ diff --git a/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py b/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py index 1e3cb2808..d06bf4751 100644 --- a/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py +++ b/tests/functional/ext/redefined_variable_type/regression_newtype_fstring.py @@ -1,5 +1,5 @@ """Regression test for issue 5770: NewType created with f-string -See: https://github.com/PyCQA/pylint/issues/5770 +See: https://github.com/pylint-dev/pylint/issues/5770 """ from typing import NewType diff --git a/tests/functional/ext/typing/typing_consider_using_alias.py b/tests/functional/ext/typing/typing_consider_using_alias.py index 8fe3b5918..070451cf0 100644 --- a/tests/functional/ext/typing/typing_consider_using_alias.py +++ b/tests/functional/ext/typing/typing_consider_using_alias.py @@ -7,7 +7,7 @@ With 'from __future__ import annotations' present. # pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unnecessary-direct-lambda-call # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from __future__ import annotations diff --git a/tests/functional/ext/typing/typing_consider_using_alias_without_future.py b/tests/functional/ext/typing/typing_consider_using_alias_without_future.py index 943a16188..b597e955e 100644 --- a/tests/functional/ext/typing/typing_consider_using_alias_without_future.py +++ b/tests/functional/ext/typing/typing_consider_using_alias_without_future.py @@ -7,7 +7,7 @@ # pylint: disable=unnecessary-direct-lambda-call # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import collections diff --git a/tests/functional/ext/typing/typing_consider_using_union.py b/tests/functional/ext/typing/typing_consider_using_union.py index 780a96100..64918175e 100644 --- a/tests/functional/ext/typing/typing_consider_using_union.py +++ b/tests/functional/ext/typing/typing_consider_using_union.py @@ -8,7 +8,7 @@ With 'from __future__ import annotations' present. # pylint: disable=consider-using-alias,unnecessary-direct-lambda-call # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from __future__ import annotations diff --git a/tests/functional/ext/typing/typing_consider_using_union_without_future.py b/tests/functional/ext/typing/typing_consider_using_union_without_future.py index d29ba306e..3cad6cb74 100644 --- a/tests/functional/ext/typing/typing_consider_using_union_without_future.py +++ b/tests/functional/ext/typing/typing_consider_using_union_without_future.py @@ -7,7 +7,7 @@ # pylint: disable=consider-using-alias # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from dataclasses import dataclass diff --git a/tests/functional/g/generated_members.py b/tests/functional/g/generated_members.py index ffb3de631..25afa7598 100644 --- a/tests/functional/g/generated_members.py +++ b/tests/functional/g/generated_members.py @@ -20,7 +20,7 @@ session.rollback() SESSION.rollback() -# https://github.com/PyCQA/pylint/issues/6594 +# https://github.com/pylint-dev/pylint/issues/6594 # Don't emit no-member inside type annotations # with PEP 563 'from __future__ import annotations' print(Klass.X) # [no-member] diff --git a/tests/functional/g/globals.py b/tests/functional/g/globals.py index f7a634a3e..7f4e3077e 100644 --- a/tests/functional/g/globals.py +++ b/tests/functional/g/globals.py @@ -105,7 +105,7 @@ def init_connection_state(alias): # Prevent emitting `invalid-name` for the line on which `global` is declared -# https://github.com/PyCQA/pylint/issues/8307 +# https://github.com/pylint-dev/pylint/issues/8307 _foo: str = "tomato" def setup_shared_foo(): diff --git a/tests/functional/i/import_error.py b/tests/functional/i/import_error.py index 12f56f9ea..474a53b5a 100644 --- a/tests/functional/i/import_error.py +++ b/tests/functional/i/import_error.py @@ -80,8 +80,14 @@ import foo, bar # [multiple-imports] import foo import bar +import mymodule_ignored +import mymodule.something_ignored +from mymodule.something_ignored import anything +import sys.something_ignored +from sys.something_ignored import anything + # Issues with contextlib.suppress reported in -# https://github.com/PyCQA/pylint/issues/7270 +# https://github.com/pylint-dev/pylint/issues/7270 import contextlib with contextlib.suppress(ImportError): import foo2 diff --git a/tests/functional/i/import_error.rc b/tests/functional/i/import_error.rc index d8f2b25e2..7278ff8f1 100644 --- a/tests/functional/i/import_error.rc +++ b/tests/functional/i/import_error.rc @@ -3,7 +3,7 @@ disable=C,R,W enable=multiple-imports [TYPECHECK] -ignored-modules=external_module,fake_module.submodule,foo,bar +ignored-modules=external_module,fake_module.submodule,foo,bar,*_ignored [testoptions] # TODO: PY3.9: This does pass on PyPy 3.9 diff --git a/tests/functional/i/import_error.txt b/tests/functional/i/import_error.txt index 80a5732f0..49cc0a673 100644 --- a/tests/functional/i/import_error.txt +++ b/tests/functional/i/import_error.txt @@ -3,4 +3,4 @@ import-error:21:4:21:26::Unable to import 'maybe_missing_2':UNDEFINED no-name-in-module:33:0:33:49::No name 'syntax_error' in module 'functional.s.syntax':UNDEFINED syntax-error:33:0:None:None::Cannot import 'functional.s.syntax.syntax_error' due to 'invalid syntax (<unknown>, line 1)':HIGH multiple-imports:78:0:78:15::Multiple imports on one line (foo, bar):UNDEFINED -import-error:90:4:90:15::Unable to import 'foo2':UNDEFINED +import-error:96:4:96:15::Unable to import 'foo2':UNDEFINED diff --git a/tests/functional/i/inconsistent/inconsistent_returns.py b/tests/functional/i/inconsistent/inconsistent_returns.py index 4e9a68377..bcdfd76e5 100644 --- a/tests/functional/i/inconsistent/inconsistent_returns.py +++ b/tests/functional/i/inconsistent/inconsistent_returns.py @@ -336,7 +336,7 @@ def bug_pylint_3873_2(): nothing_to_do() return False -# https://github.com/PyCQA/pylint/issues/4019 +# https://github.com/pylint-dev/pylint/issues/4019 def bug_pylint_4019(x): """ assert False is equivalent to a return @@ -355,7 +355,7 @@ def bug_pylint_4019_wrong(x): # [inconsistent-return-statements] assert True -# https://github.com/PyCQA/pylint/issues/8280 +# https://github.com/pylint-dev/pylint/issues/8280 class A: def get_the_answer(self): # [inconsistent-return-statements] while self.is_running: diff --git a/tests/functional/i/inference_crash_4692.py b/tests/functional/i/inference_crash_4692.py index 5e990aaa7..d41ac7a84 100644 --- a/tests/functional/i/inference_crash_4692.py +++ b/tests/functional/i/inference_crash_4692.py @@ -1,4 +1,4 @@ -"""Regression test for https://github.com/PyCQA/pylint/issues/4692.""" +"""Regression test for https://github.com/pylint-dev/pylint/issues/4692.""" # We can't use click like in the issue because the crash # does not appear if click is installed (astroid can analyse it) diff --git a/tests/functional/i/init_not_called.py b/tests/functional/i/init_not_called.py index ee8c4f5a1..db677dc4b 100644 --- a/tests/functional/i/init_not_called.py +++ b/tests/functional/i/init_not_called.py @@ -86,7 +86,7 @@ class Child(Parent): super().__init__(round(num)) -# https://github.com/PyCQA/pylint/issues/7742 +# https://github.com/pylint-dev/pylint/issues/7742 # Crash when parent class has a class attribute named `__init__` class NoInitMethod: __init__ = 42 diff --git a/tests/functional/i/invalid/invalid_all_format.py b/tests/functional/i/invalid/invalid_all/invalid_all_format.py index 10537c6fb..10537c6fb 100644 --- a/tests/functional/i/invalid/invalid_all_format.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format.py diff --git a/tests/functional/i/invalid/invalid_all_format.txt b/tests/functional/i/invalid/invalid_all/invalid_all_format.txt index 2f6ac363b..2f6ac363b 100644 --- a/tests/functional/i/invalid/invalid_all_format.txt +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format.txt diff --git a/tests/functional/i/invalid/invalid_all_format_valid_1.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_1.py index f3d8b4361..f3d8b4361 100644 --- a/tests/functional/i/invalid/invalid_all_format_valid_1.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_1.py diff --git a/tests/functional/i/invalid/invalid_all_format_valid_2.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_2.py index aa243c65b..aa243c65b 100644 --- a/tests/functional/i/invalid/invalid_all_format_valid_2.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_2.py diff --git a/tests/functional/i/invalid/invalid_all_format_valid_3.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_3.py index 3725d055e..3725d055e 100644 --- a/tests/functional/i/invalid/invalid_all_format_valid_3.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_3.py diff --git a/tests/functional/i/invalid/invalid_all_format_valid_4.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_4.py index 65a8c384b..65a8c384b 100644 --- a/tests/functional/i/invalid/invalid_all_format_valid_4.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_4.py diff --git a/tests/functional/i/invalid/invalid_all_format_valid_5.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_5.py index aa0e4dbf3..aa0e4dbf3 100644 --- a/tests/functional/i/invalid/invalid_all_format_valid_5.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_5.py diff --git a/tests/functional/i/invalid/invalid_all_format_valid_6.py b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_6.py index 64ac46bb7..64ac46bb7 100644 --- a/tests/functional/i/invalid/invalid_all_format_valid_6.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_format_valid_6.py diff --git a/tests/functional/i/invalid/invalid_all_object.py b/tests/functional/i/invalid/invalid_all/invalid_all_object.py index 4468c987b..4468c987b 100644 --- a/tests/functional/i/invalid/invalid_all_object.py +++ b/tests/functional/i/invalid/invalid_all/invalid_all_object.py diff --git a/tests/functional/i/invalid/invalid_all_object.txt b/tests/functional/i/invalid/invalid_all/invalid_all_object.txt index 172fc974c..172fc974c 100644 --- a/tests/functional/i/invalid/invalid_all_object.txt +++ b/tests/functional/i/invalid/invalid_all/invalid_all_object.txt diff --git a/tests/functional/i/invalid/invalid_class_object.py b/tests/functional/i/invalid/invalid_class_object.py index b7363e9c8..8233a3633 100644 --- a/tests/functional/i/invalid/invalid_class_object.py +++ b/tests/functional/i/invalid/invalid_class_object.py @@ -40,7 +40,7 @@ class AnotherClass: class Pylint7429Good:
- """See https://github.com/PyCQA/pylint/issues/7467"""
+ """See https://github.com/pylint-dev/pylint/issues/7467"""
def class_defining_function_good(self):
self.__class__, myvar = AnotherClass, "myvalue"
diff --git a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py index a0b5ad39f..aa37a4530 100644 --- a/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py +++ b/tests/functional/i/invalid/invalid_exceptions/invalid_exceptions_raised.py @@ -99,7 +99,7 @@ def reusing_same_name_picks_the_latest_raised_value(): try: raise ValueError except exceptions as exc: # pylint: disable=catching-non-exception - # https://github.com/PyCQA/pylint/issues/1756 + # https://github.com/pylint-dev/pylint/issues/1756 exc = Error(exc) if exc: raise exc diff --git a/tests/functional/i/invalid/invalid_metaclass.py b/tests/functional/i/invalid/invalid_metaclass.py index 3b264d693..aba4e6fb1 100644 --- a/tests/functional/i/invalid/invalid_metaclass.py +++ b/tests/functional/i/invalid/invalid_metaclass.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring, too-few-public-methods, import-error,unused-argument # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import abc diff --git a/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py b/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py index f6074eebb..3d3be3180 100644 --- a/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py +++ b/tests/functional/i/invalid/invalid_name/invalid_name-module-disable.py @@ -2,5 +2,5 @@ """Regression test for disabling of invalid-name for module names. -See https://github.com/PyCQA/pylint/issues/3973. +See https://github.com/pylint-dev/pylint/issues/3973. """ diff --git a/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py b/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py index 9b0dd37cd..678aaf076 100644 --- a/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py +++ b/tests/functional/i/invalid/invalid_name/invalid_name_issue_3405.py @@ -1,4 +1,4 @@ -""" Regression test for https://github.com/PyCQA/pylint/issues/3405. """ +""" Regression test for https://github.com/pylint-dev/pylint/issues/3405. """ import dataclasses from typing import ClassVar diff --git a/tests/functional/i/invalid/invalid_overridden_method.py b/tests/functional/i/invalid/invalid_overridden_method.py index 69af42a0a..d81a7882b 100644 --- a/tests/functional/i/invalid/invalid_overridden_method.py +++ b/tests/functional/i/invalid/invalid_overridden_method.py @@ -78,7 +78,7 @@ class AbstractProperty: return -# https://github.com/PyCQA/pylint/issues/4368 +# https://github.com/pylint-dev/pylint/issues/4368 # Decrator functions with a nested property decorator should still be # inferred as property. diff --git a/tests/functional/i/invalid/invalid_sequence_index.py b/tests/functional/i/invalid/invalid_sequence_index.py index 56ade211b..e2a3abc7e 100644 --- a/tests/functional/i/invalid/invalid_sequence_index.py +++ b/tests/functional/i/invalid/invalid_sequence_index.py @@ -1,7 +1,7 @@ # pylint: disable=too-few-public-methods, import-error, missing-docstring, unnecessary-pass # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import six diff --git a/tests/functional/i/iterable_context.py b/tests/functional/i/iterable_context.py index fb035c4df..b36710f28 100644 --- a/tests/functional/i/iterable_context.py +++ b/tests/functional/i/iterable_context.py @@ -192,5 +192,5 @@ for elem in HasDynamicGetattr(): pass -# Regression test for https://github.com/PyCQA/pylint/issues/6372 +# Regression test for https://github.com/pylint-dev/pylint/issues/6372 string_twos = "".join(str(*y) for _, *y in [[1, 2], [1, 2]]) diff --git a/tests/functional/m/member/member_checks_inference_improvements.py b/tests/functional/m/member/member_checks_inference_improvements.py index 6eefa7958..099048ba0 100644 --- a/tests/functional/m/member/member_checks_inference_improvements.py +++ b/tests/functional/m/member/member_checks_inference_improvements.py @@ -2,7 +2,7 @@ def test_oserror_has_strerror(): - # https://github.com/PyCQA/pylint/issues/2553 + # https://github.com/pylint-dev/pylint/issues/2553 try: raise OSError() except OSError as exc: diff --git a/tests/functional/m/modified_iterating.py b/tests/functional/m/modified_iterating.py index f17c34b6e..2dae6c106 100644 --- a/tests/functional/m/modified_iterating.py +++ b/tests/functional/m/modified_iterating.py @@ -97,7 +97,7 @@ def update_existing_key(): class MyClass: - """Regression test for https://github.com/PyCQA/pylint/issues/7380""" + """Regression test for https://github.com/pylint-dev/pylint/issues/7380""" def __init__(self) -> None: self.attribute = [1, 2, 3] @@ -109,7 +109,7 @@ class MyClass: class MyClass2: - """Regression test for https://github.com/PyCQA/pylint/issues/7461""" + """Regression test for https://github.com/pylint-dev/pylint/issues/7461""" def __init__(self) -> None: self.attribute = {} diff --git a/tests/functional/n/no/no_member.py b/tests/functional/n/no/no_member.py index 1db70cde5..a36fc359e 100644 --- a/tests/functional/n/no/no_member.py +++ b/tests/functional/n/no/no_member.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring, unused-argument, wrong-import-position, invalid-name from pathlib import Path -# Regression test for https://github.com/PyCQA/pylint/issues/400 +# Regression test for https://github.com/pylint-dev/pylint/issues/400 class TestListener: def __init__(self): self._latest = None @@ -19,7 +19,7 @@ listener = TestListener() broker = listener.wait(3).get_domain() # No error here -# Regression test for https://github.com/PyCQA/pylint/issues/4377 +# Regression test for https://github.com/pylint-dev/pylint/issues/4377 from urllib import parse url = 'http://www.google.com' @@ -31,7 +31,7 @@ new_parsed_url = parse.ParseResult._replace(parsed_url, query=sorted_query) new_url = new_parsed_url.geturl() # No error here -# Regression test for https://github.com/PyCQA/pylint/issues/3803 +# Regression test for https://github.com/pylint-dev/pylint/issues/3803 # pylint: disable=too-few-public-methods class Base: label: str @@ -44,5 +44,5 @@ class Derived(Base): print(Derived.label) -# Regression test for https://github.com/PyCQA/pylint/issues/5832 +# Regression test for https://github.com/pylint-dev/pylint/issues/5832 starter_path = Path(__file__).parents[3].resolve() diff --git a/tests/functional/n/no/no_member_assign_same_line.py b/tests/functional/n/no/no_member_assign_same_line.py index 45138d933..230b08109 100644 --- a/tests/functional/n/no/no_member_assign_same_line.py +++ b/tests/functional/n/no/no_member_assign_same_line.py @@ -1,5 +1,5 @@ """Tests for no-member for self-referencing instance attributes -See https://github.com/PyCQA/pylint/issues/1555 +See https://github.com/pylint-dev/pylint/issues/1555 """ # pylint: disable=too-few-public-methods diff --git a/tests/functional/n/no/no_member_augassign.py b/tests/functional/n/no/no_member_augassign.py index 1ffd9a168..8954861e3 100644 --- a/tests/functional/n/no/no_member_augassign.py +++ b/tests/functional/n/no/no_member_augassign.py @@ -1,7 +1,7 @@ """Tests for no-member in relation to AugAssign operations.""" # pylint: disable=missing-module-docstring, too-few-public-methods, missing-class-docstring, invalid-name -# Test for: https://github.com/PyCQA/pylint/issues/4562 +# Test for: https://github.com/pylint-dev/pylint/issues/4562 class A: value: int diff --git a/tests/functional/n/no/no_member_binary_operations.py b/tests/functional/n/no/no_member_binary_operations.py index e998932eb..1a15fa2d4 100644 --- a/tests/functional/n/no/no_member_binary_operations.py +++ b/tests/functional/n/no/no_member_binary_operations.py @@ -1,7 +1,7 @@ """Tests for no-member in relation to binary operations.""" # pylint: disable=too-few-public-methods, missing-class-docstring, missing-function-docstring -# Test for: https://github.com/PyCQA/pylint/issues/4826 +# Test for: https://github.com/pylint-dev/pylint/issues/4826 class MyClass: def __init__(self): self.a_list = [] diff --git a/tests/functional/n/no/no_member_dataclasses.py b/tests/functional/n/no/no_member_dataclasses.py index 97528e698..5f799bf84 100644 --- a/tests/functional/n/no/no_member_dataclasses.py +++ b/tests/functional/n/no/no_member_dataclasses.py @@ -3,7 +3,7 @@ # pylint: disable=missing-docstring, too-few-public-methods # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from abc import ABCMeta, abstractmethod @@ -11,7 +11,7 @@ from dataclasses import asdict, dataclass, field from typing import Any, Dict -# https://github.com/PyCQA/pylint/issues/3754 +# https://github.com/pylint-dev/pylint/issues/3754 @dataclass(frozen=True) class DeploymentState(metaclass=ABCMeta): type: str @@ -52,7 +52,7 @@ class DeploymentStateLambda(DeploymentState): } -# https://github.com/PyCQA/pylint/issues/2600 +# https://github.com/pylint-dev/pylint/issues/2600 @dataclass class TestClass: attr1: str diff --git a/tests/functional/n/no/no_member_if_statements.py b/tests/functional/n/no/no_member_if_statements.py index d26c5c483..220d0215a 100644 --- a/tests/functional/n/no/no_member_if_statements.py +++ b/tests/functional/n/no/no_member_if_statements.py @@ -40,7 +40,7 @@ class Base: return str(state) -# https://github.com/PyCQA/pylint/issues/1990 +# https://github.com/pylint-dev/pylint/issues/1990 # Attribute access after 'isinstance' should not cause 'no-member' error import subprocess # pylint: disable=wrong-import-position # noqa: E402 @@ -54,7 +54,7 @@ except Exception as err: raise -# https://github.com/PyCQA/pylint/issues/4168 +# https://github.com/pylint-dev/pylint/issues/4168 # 'encode' for 'arg' should not cause 'no-member' error mixed_tuple = (b"a", b"b", b"c", b"d") byte_tuple = [arg.encode('utf8') if isinstance(arg, str) else arg for arg in mixed_tuple] @@ -66,7 +66,7 @@ for arg in mixed_tuple: print(arg) -# https://github.com/PyCQA/pylint/issues/1162 +# https://github.com/pylint-dev/pylint/issues/1162 # Attribute access after 'isinstance' should not cause 'no-member' error class FoobarException(Exception): foobar = None diff --git a/tests/functional/n/no/no_member_subclassed_dataclasses.py b/tests/functional/n/no/no_member_subclassed_dataclasses.py index 0dee10840..d121eae36 100644 --- a/tests/functional/n/no/no_member_subclassed_dataclasses.py +++ b/tests/functional/n/no/no_member_subclassed_dataclasses.py @@ -2,7 +2,7 @@ # pylint: disable=too-few-public-methods # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from abc import ABCMeta, abstractmethod diff --git a/tests/functional/n/no/no_name_in_module.py b/tests/functional/n/no/no_name_in_module.py index 26c0079b6..ef9fb03d1 100644 --- a/tests/functional/n/no/no_name_in_module.py +++ b/tests/functional/n/no/no_name_in_module.py @@ -80,7 +80,7 @@ from .no_self_argument.bla import lala1 # [no-name-in-module] from argparse import THIS_does_not_EXIST -# This captures the original failure in https://github.com/PyCQA/pylint/issues/6497 +# This captures the original failure in https://github.com/pylint-dev/pylint/issues/6497 # only if numpy is installed. We are not installing numpy on CI (for now) from numpy.distutils.misc_util import is_sequence from pydantic import BaseModel diff --git a/tests/functional/n/none_dunder_protocols.py b/tests/functional/n/none_dunder_protocols.py index 4f4628634..085615910 100644 --- a/tests/functional/n/none_dunder_protocols.py +++ b/tests/functional/n/none_dunder_protocols.py @@ -30,7 +30,7 @@ class MultipleAssignmentNonesClass(metaclass=MetaContainer): class MultipleAssignmentLambdasClass(metaclass=MetaContainer): - """https://github.com/PyCQA/pylint/issues/6366""" + """https://github.com/pylint-dev/pylint/issues/6366""" __len__, __iter__ = [lambda x: x] * 2 diff --git a/tests/functional/n/nonlocal_without_binding.py b/tests/functional/n/nonlocal_without_binding.py index c05a012b1..277c7f7eb 100644 --- a/tests/functional/n/nonlocal_without_binding.py +++ b/tests/functional/n/nonlocal_without_binding.py @@ -30,7 +30,7 @@ def func(): # Case where `nonlocal-without-binding` was not emitted when # the nonlocal name was assigned later in the same scope. - # https://github.com/PyCQA/pylint/issues/6883 + # https://github.com/pylint-dev/pylint/issues/6883 def other_func2(): nonlocal c # [nonlocal-without-binding] c = 1 diff --git a/tests/functional/n/not_callable.py b/tests/functional/n/not_callable.py index c5015e65f..a0411d39e 100644 --- a/tests/functional/n/not_callable.py +++ b/tests/functional/n/not_callable.py @@ -128,7 +128,7 @@ UnknownBaseCallable()() # Regression test for #4426 # If property is inferable we shouldn't double emit the message -# See: https://github.com/PyCQA/pylint/issues/4426 +# See: https://github.com/pylint-dev/pylint/issues/4426 class ClassWithProperty: @property def value(self): @@ -137,15 +137,15 @@ class ClassWithProperty: CLASS_WITH_PROP = ClassWithProperty().value() # [not-callable] # Test typing.Namedtuple is callable -# See: https://github.com/PyCQA/pylint/issues/1295 +# See: https://github.com/pylint-dev/pylint/issues/1295 import typing Named = typing.NamedTuple("Named", [("foo", int), ("bar", int)]) named = Named(1, 2) -# NamedTuple is callable, even if it aliased to a attribute -# See https://github.com/PyCQA/pylint/issues/1730 +# NamedTuple is callable, even if it aliased to an attribute +# See https://github.com/pylint-dev/pylint/issues/1730 class TestNamedTuple: def __init__(self, field: str) -> None: self.my_tuple = typing.NamedTuple("Tuple", [(field, int)]) @@ -178,7 +178,7 @@ AggregateCls().a() # pylint needs to ignore not-callable for them # right now -# Test for https://github.com/PyCQA/pylint/issues/1699 +# Test for https://github.com/pylint-dev/pylint/issues/1699 import multiprocessing @@ -226,7 +226,7 @@ obj2 = Klass2() obj2.something() -# Regression test for https://github.com/PyCQA/pylint/issues/7109 +# Regression test for https://github.com/pylint-dev/pylint/issues/7109 instance_or_cls = MyClass # pylint:disable=invalid-name instance_or_cls = MyClass() if not isinstance(instance_or_cls, MyClass): @@ -234,7 +234,7 @@ if not isinstance(instance_or_cls, MyClass): new() -# Regression test for https://github.com/PyCQA/pylint/issues/5113. +# Regression test for https://github.com/pylint-dev/pylint/issues/5113. # Do not emit `not-callable`. ATTRIBUTES = { 'DOMAIN': ("domain", str), diff --git a/tests/functional/o/overridden_final_method_py38.py b/tests/functional/o/overridden_final_method_py38.py index 252ea3c01..d92b6adc2 100644 --- a/tests/functional/o/overridden_final_method_py38.py +++ b/tests/functional/o/overridden_final_method_py38.py @@ -16,7 +16,7 @@ class Subclass(Base): pass # Check for crash on method definitions not at top level of class -# https://github.com/PyCQA/pylint/issues/5648 +# https://github.com/pylint-dev/pylint/issues/5648 class BaseConditional: create_final_method = True diff --git a/tests/functional/p/postponed_evaluation_activated.py b/tests/functional/p/postponed/postponed_evaluation_activated.py index 3492fe5c2..3492fe5c2 100644 --- a/tests/functional/p/postponed_evaluation_activated.py +++ b/tests/functional/p/postponed/postponed_evaluation_activated.py diff --git a/tests/functional/p/postponed_evaluation_activated.rc b/tests/functional/p/postponed/postponed_evaluation_activated.rc index a17bb22da..a17bb22da 100644 --- a/tests/functional/p/postponed_evaluation_activated.rc +++ b/tests/functional/p/postponed/postponed_evaluation_activated.rc diff --git a/tests/functional/p/postponed_evaluation_activated_with_alias.py b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.py index f9899f34a..f9899f34a 100644 --- a/tests/functional/p/postponed_evaluation_activated_with_alias.py +++ b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.py diff --git a/tests/functional/p/postponed_evaluation_activated_with_alias.rc b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.rc index a17bb22da..a17bb22da 100644 --- a/tests/functional/p/postponed_evaluation_activated_with_alias.rc +++ b/tests/functional/p/postponed/postponed_evaluation_activated_with_alias.rc diff --git a/tests/functional/p/postponed_evaluation_not_activated.py b/tests/functional/p/postponed/postponed_evaluation_not_activated.py index 76e564a9a..76e564a9a 100644 --- a/tests/functional/p/postponed_evaluation_not_activated.py +++ b/tests/functional/p/postponed/postponed_evaluation_not_activated.py diff --git a/tests/functional/p/postponed_evaluation_not_activated.rc b/tests/functional/p/postponed/postponed_evaluation_not_activated.rc index a17bb22da..a17bb22da 100644 --- a/tests/functional/p/postponed_evaluation_not_activated.rc +++ b/tests/functional/p/postponed/postponed_evaluation_not_activated.rc diff --git a/tests/functional/p/postponed_evaluation_not_activated.txt b/tests/functional/p/postponed/postponed_evaluation_not_activated.txt index 8d9630e04..8d9630e04 100644 --- a/tests/functional/p/postponed_evaluation_not_activated.txt +++ b/tests/functional/p/postponed/postponed_evaluation_not_activated.txt diff --git a/tests/functional/p/postponed_evaluation_pep585.py b/tests/functional/p/postponed/postponed_evaluation_pep585.py index 1d539126d..2317228e5 100644 --- a/tests/functional/p/postponed_evaluation_pep585.py +++ b/tests/functional/p/postponed/postponed_evaluation_pep585.py @@ -9,7 +9,7 @@ Testing with 3.8 only, to support TypedDict. # pylint: disable=unused-variable,unnecessary-direct-lambda-call # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from __future__ import annotations diff --git a/tests/functional/p/postponed_evaluation_pep585.rc b/tests/functional/p/postponed/postponed_evaluation_pep585.rc index 35b185fdb..35b185fdb 100644 --- a/tests/functional/p/postponed_evaluation_pep585.rc +++ b/tests/functional/p/postponed/postponed_evaluation_pep585.rc diff --git a/tests/functional/p/postponed_evaluation_pep585.txt b/tests/functional/p/postponed/postponed_evaluation_pep585.txt index 899dc5977..899dc5977 100644 --- a/tests/functional/p/postponed_evaluation_pep585.txt +++ b/tests/functional/p/postponed/postponed_evaluation_pep585.txt diff --git a/tests/functional/p/postponed_evaluation_pep585_error.py b/tests/functional/p/postponed/postponed_evaluation_pep585_error.py index 19153105e..9810c0c14 100644 --- a/tests/functional/p/postponed_evaluation_pep585_error.py +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.py @@ -9,7 +9,7 @@ Testing with 3.8 only, to support TypedDict. # pylint: disable=unused-variable,line-too-long,unnecessary-direct-lambda-call # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import collections diff --git a/tests/functional/p/postponed_evaluation_pep585_error.rc b/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc index 35b185fdb..35b185fdb 100644 --- a/tests/functional/p/postponed_evaluation_pep585_error.rc +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc diff --git a/tests/functional/p/postponed_evaluation_pep585_error.txt b/tests/functional/p/postponed/postponed_evaluation_pep585_error.txt index 406081dfa..406081dfa 100644 --- a/tests/functional/p/postponed_evaluation_pep585_error.txt +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.txt diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.py b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.py index 5354e081f..5354e081f 100644 --- a/tests/functional/p/postponed_evaluation_pep585_py39.py +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.py diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.rc b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.rc index 16b75eea7..16b75eea7 100644 --- a/tests/functional/p/postponed_evaluation_pep585_py39.rc +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.rc diff --git a/tests/functional/p/postponed_evaluation_pep585_py39.txt b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.txt index 127e252a5..127e252a5 100644 --- a/tests/functional/p/postponed_evaluation_pep585_py39.txt +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_py39.txt diff --git a/tests/functional/r/recursion/recursion_error_2667.py b/tests/functional/r/recursion/recursion_error_2667.py index 585cf7f2f..62868c3c6 100644 --- a/tests/functional/r/recursion/recursion_error_2667.py +++ b/tests/functional/r/recursion/recursion_error_2667.py @@ -1,4 +1,4 @@ -"""Add regression test for https://github.com/PyCQA/pylint/issues/2667""" +"""Add regression test for https://github.com/pylint-dev/pylint/issues/2667""" # pylint: disable=missing-docstring, too-few-public-methods class MyClass: diff --git a/tests/functional/r/recursion/recursion_error_2906.py b/tests/functional/r/recursion/recursion_error_2906.py index 6b4b08d5f..b18d27315 100644 --- a/tests/functional/r/recursion/recursion_error_2906.py +++ b/tests/functional/r/recursion/recursion_error_2906.py @@ -1,4 +1,4 @@ -"""Recursion error for https://github.com/PyCQA/pylint/issues/2906""" +"""Recursion error for https://github.com/pylint-dev/pylint/issues/2906""" # pylint: disable=disallowed-name,global-statement,invalid-name,missing-docstring lst = [] diff --git a/tests/functional/r/recursion/recursion_error_3159.py b/tests/functional/r/recursion/recursion_error_3159.py index 086cce769..d905ad862 100644 --- a/tests/functional/r/recursion/recursion_error_3159.py +++ b/tests/functional/r/recursion/recursion_error_3159.py @@ -1,6 +1,6 @@ """Check that we do not crash with a recursion error -https://github.com/PyCQA/pylint/issues/3159 +https://github.com/pylint-dev/pylint/issues/3159 """ # pylint: disable=missing-docstring from setuptools import Command, find_packages, setup diff --git a/tests/functional/r/recursion/recursion_error_crash.py b/tests/functional/r/recursion/recursion_error_crash.py index 208bc2e7a..5500428b4 100644 --- a/tests/functional/r/recursion/recursion_error_crash.py +++ b/tests/functional/r/recursion/recursion_error_crash.py @@ -1,6 +1,6 @@ """Test that a recursion error does not happen -https://github.com/PyCQA/pylint/issues/2463 +https://github.com/pylint-dev/pylint/issues/2463 """ import os diff --git a/tests/functional/r/recursion/recursion_error_crash_2683.py b/tests/functional/r/recursion/recursion_error_crash_2683.py index 05978a355..17335de2b 100644 --- a/tests/functional/r/recursion/recursion_error_crash_2683.py +++ b/tests/functional/r/recursion/recursion_error_crash_2683.py @@ -1,4 +1,4 @@ -"""Test for https://github.com/PyCQA/pylint/issues/2683""" +"""Test for https://github.com/pylint-dev/pylint/issues/2683""" # pylint: disable=missing-docstring,too-few-public-methods class Cls: diff --git a/tests/functional/r/recursion/recursion_error_crash_astroid_623.py b/tests/functional/r/recursion/recursion_error_crash_astroid_623.py index 662da6145..e73ff42c5 100644 --- a/tests/functional/r/recursion/recursion_error_crash_astroid_623.py +++ b/tests/functional/r/recursion/recursion_error_crash_astroid_623.py @@ -1,6 +1,6 @@ """Test that a recursion error does not happen -https://github.com/PyCQA/astroid/issues/623 +https://github.com/pylint-dev/astroid/issues/623 """ from os import path diff --git a/tests/functional/r/redefined/redefined_except_handler.py b/tests/functional/r/redefined/redefined_except_handler.py index 47591034a..b774e32f2 100644 --- a/tests/functional/r/redefined/redefined_except_handler.py +++ b/tests/functional/r/redefined/redefined_except_handler.py @@ -1,6 +1,6 @@ """Tests for except handlers that shadow outer except handlers or exceptions. -See: https://github.com/PyCQA/pylint/issues/5370 +See: https://github.com/pylint-dev/pylint/issues/5370 """ try: @@ -60,7 +60,7 @@ except ImportError as err: class CustomException(Exception): - """https://github.com/PyCQA/pylint/issues/4434""" + """https://github.com/pylint-dev/pylint/issues/4434""" def func(): diff --git a/tests/functional/r/redefined/redefined_slots.py b/tests/functional/r/redefined/redefined_slots.py index 28f05fbfd..fbeda46e1 100644 --- a/tests/functional/r/redefined/redefined_slots.py +++ b/tests/functional/r/redefined/redefined_slots.py @@ -33,7 +33,7 @@ class Subclass3(Base, Base2): __slots__ = ("a", "b", "c", "i", "j", "k", "l", "m", "n") # [redefined-slots-in-subclass] -# https://github.com/PyCQA/pylint/issues/6100 +# https://github.com/pylint-dev/pylint/issues/6100 class MyClass: """No crash when the type of the slot is not a Const or a str""" __slots__ = [str] diff --git a/tests/functional/r/redundant_unittest_assert.py b/tests/functional/r/redundant_unittest_assert.py index aa4120831..0bc2d69dd 100644 --- a/tests/functional/r/redundant_unittest_assert.py +++ b/tests/functional/r/redundant_unittest_assert.py @@ -7,7 +7,7 @@ a warning message. # pylint: disable=missing-docstring,too-few-public-methods # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import unittest diff --git a/tests/functional/r/regression/regression_3416_unused_argument_raise.py b/tests/functional/r/regression/regression_3416_unused_argument_raise.py index 9bc761701..175afaf3d 100644 --- a/tests/functional/r/regression/regression_3416_unused_argument_raise.py +++ b/tests/functional/r/regression/regression_3416_unused_argument_raise.py @@ -1,6 +1,6 @@ """Test that we emit unused-argument when a function uses `raise -https://github.com/PyCQA/pylint/issues/3416 +https://github.com/pylint-dev/pylint/issues/3416 """ # pylint:disable=raise-missing-from diff --git a/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py b/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py index 4dba85545..c55b460ce 100644 --- a/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py +++ b/tests/functional/r/regression/regression_3507_typing_alias_isinstance.py @@ -1,5 +1,5 @@ """ -https://github.com/PyCQA/pylint/issues/3507 +https://github.com/pylint-dev/pylint/issues/3507 False-positive 'isinstance-second-argument-not-valid-type' for typing aliases in 'isinstance' calls. """ diff --git a/tests/functional/r/regression/regression_3535_double_enum_inherit.py b/tests/functional/r/regression/regression_3535_double_enum_inherit.py index 374b5f860..7b5f40348 100644 --- a/tests/functional/r/regression/regression_3535_double_enum_inherit.py +++ b/tests/functional/r/regression/regression_3535_double_enum_inherit.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring,invalid-name -# https://github.com/PyCQA/pylint/issues/3535 +# https://github.com/pylint-dev/pylint/issues/3535 import enum diff --git a/tests/functional/r/regression/regression_3595_notcallable_collections.py b/tests/functional/r/regression/regression_3595_notcallable_collections.py index 120b26a04..4c50d1f18 100644 --- a/tests/functional/r/regression/regression_3595_notcallable_collections.py +++ b/tests/functional/r/regression/regression_3595_notcallable_collections.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring,unused-import -# https://github.com/PyCQA/pylint/issues/3595 +# https://github.com/pylint-dev/pylint/issues/3595 import collections diff --git a/tests/functional/r/regression/regression_4221_object_instanceattr.py b/tests/functional/r/regression/regression_4221_object_instanceattr.py index 4c346b145..6599bf249 100644 --- a/tests/functional/r/regression/regression_4221_object_instanceattr.py +++ b/tests/functional/r/regression/regression_4221_object_instanceattr.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring -# https://github.com/PyCQA/pylint/issues/4221 +# https://github.com/pylint-dev/pylint/issues/4221 import random o = object() diff --git a/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py b/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py index 63a9d7749..9f3b6d4b6 100644 --- a/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py +++ b/tests/functional/r/regression/regression_4358_unsubscriptable_enum.py @@ -1,5 +1,5 @@ # pylint: disable=pointless-statement,missing-docstring -# https://github.com/PyCQA/pylint/issues/4358 +# https://github.com/pylint-dev/pylint/issues/4358 from enum import Enum diff --git a/tests/functional/r/regression/regression_4439.py b/tests/functional/r/regression/regression_4439.py index dd9c39253..3dc60cf9c 100644 --- a/tests/functional/r/regression/regression_4439.py +++ b/tests/functional/r/regression/regression_4439.py @@ -2,7 +2,7 @@ # pylint: disable=missing-docstring # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from typing import Optional diff --git a/tests/functional/r/regression/regression_6531_crash_index_error.py b/tests/functional/r/regression/regression_6531_crash_index_error.py index 6cdc96617..cfcfd8e60 100644 --- a/tests/functional/r/regression/regression_6531_crash_index_error.py +++ b/tests/functional/r/regression/regression_6531_crash_index_error.py @@ -1,4 +1,4 @@ -"""Regression test for https://github.com/PyCQA/pylint/issues/6531.""" +"""Regression test for https://github.com/pylint-dev/pylint/issues/6531.""" # pylint: disable=missing-docstring, redefined-outer-name diff --git a/tests/functional/r/regression/regression_issue_4633.py b/tests/functional/r/regression/regression_issue_4633.py index 0bd48ad54..b2a8f7c90 100644 --- a/tests/functional/r/regression/regression_issue_4633.py +++ b/tests/functional/r/regression/regression_issue_4633.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring,too-few-public-methods """ -Regression tests for https://github.com/PyCQA/pylint/issues/4633 +Regression tests for https://github.com/pylint-dev/pylint/issues/4633 """ from queue import Queue diff --git a/tests/functional/r/regression/regression_no_member_1078.py b/tests/functional/r/regression/regression_no_member_1078.py index b7be27d3c..191ba7751 100644 --- a/tests/functional/r/regression/regression_no_member_1078.py +++ b/tests/functional/r/regression/regression_no_member_1078.py @@ -1,6 +1,6 @@ """Make sure no-member is not emitted when modifying __doc__ via augmented assignment -https://github.com/PyCQA/pylint/issues/1078 +https://github.com/pylint-dev/pylint/issues/1078 """ # pylint: disable=too-few-public-methods,missing-class-docstring class Cls: diff --git a/tests/functional/r/regression/regression_property_no_member_2641.py b/tests/functional/r/regression/regression_property_no_member_2641.py index 083f78bdc..dd87726e6 100644 --- a/tests/functional/r/regression/regression_property_no_member_2641.py +++ b/tests/functional/r/regression/regression_property_no_member_2641.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring,unused-argument,too-few-public-methods -# https://github.com/PyCQA/pylint/issues/2641 +# https://github.com/pylint-dev/pylint/issues/2641 from abc import ABCMeta, abstractmethod diff --git a/tests/functional/r/regression/regression_property_no_member_844.py b/tests/functional/r/regression/regression_property_no_member_844.py index 759b7bfe3..279d7b250 100644 --- a/tests/functional/r/regression/regression_property_no_member_844.py +++ b/tests/functional/r/regression/regression_property_no_member_844.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring,too-few-public-methods,invalid-overridden-method -# https://github.com/PyCQA/pylint/issues/844 +# https://github.com/pylint-dev/pylint/issues/844 class Parent: def __init__(self): self.__thing = 'foo' diff --git a/tests/functional/r/regression/regression_property_no_member_870.py b/tests/functional/r/regression/regression_property_no_member_870.py index e89ae169e..500b217f9 100644 --- a/tests/functional/r/regression/regression_property_no_member_870.py +++ b/tests/functional/r/regression/regression_property_no_member_870.py @@ -1,5 +1,5 @@ # pylint: disable=too-few-public-methods,invalid-name,missing-docstring -# https://github.com/PyCQA/pylint/issues/870 +# https://github.com/pylint-dev/pylint/issues/870 class X: def __init__(self, val=None): diff --git a/tests/functional/r/regression_02/regression_2567.py b/tests/functional/r/regression_02/regression_2567.py index fe5c3f25a..7de293bfb 100644 --- a/tests/functional/r/regression_02/regression_2567.py +++ b/tests/functional/r/regression_02/regression_2567.py @@ -1,6 +1,6 @@ """ Regression test for `no-member`. -See: https://github.com/PyCQA/pylint/issues/2567 +See: https://github.com/pylint-dev/pylint/issues/2567 """ # pylint: disable=missing-docstring,too-few-public-methods diff --git a/tests/functional/r/regression_02/regression_2964.py b/tests/functional/r/regression_02/regression_2964.py index 66235fc09..ad8433091 100644 --- a/tests/functional/r/regression_02/regression_2964.py +++ b/tests/functional/r/regression_02/regression_2964.py @@ -1,6 +1,6 @@ """ Regression test for `no-member`. -See: https://github.com/PyCQA/pylint/issues/2964 +See: https://github.com/pylint-dev/pylint/issues/2964 """ # pylint: disable=missing-class-docstring,too-few-public-methods diff --git a/tests/functional/r/regression_02/regression_3976.py b/tests/functional/r/regression_02/regression_3976.py index 3610e9e30..27c119d47 100644 --- a/tests/functional/r/regression_02/regression_3976.py +++ b/tests/functional/r/regression_02/regression_3976.py @@ -1,5 +1,5 @@ """ -Regression test for https://github.com/PyCQA/pylint/issues/3976 +Regression test for https://github.com/pylint-dev/pylint/issues/3976 E1123: Unexpected keyword argument 'include_extras' in function call (unexpected-keyword-arg) """ diff --git a/tests/functional/r/regression_02/regression_3979.py b/tests/functional/r/regression_02/regression_3979.py index 7cc74a4f5..e14c5edb5 100644 --- a/tests/functional/r/regression_02/regression_3979.py +++ b/tests/functional/r/regression_02/regression_3979.py @@ -1,5 +1,5 @@ """ -Regression test for https://github.com/PyCQA/pylint/issues/3979 +Regression test for https://github.com/pylint-dev/pylint/issues/3979 """ import os diff --git a/tests/functional/r/regression_02/regression_4660.py b/tests/functional/r/regression_02/regression_4660.py index 872ed6ca2..b3dee058f 100644 --- a/tests/functional/r/regression_02/regression_4660.py +++ b/tests/functional/r/regression_02/regression_4660.py @@ -1,4 +1,4 @@ -"""Regression tests for https://github.com/PyCQA/pylint/issues/4660""" +"""Regression tests for https://github.com/pylint-dev/pylint/issues/4660""" # pylint: disable=useless-return, unused-argument # pylint: disable=missing-docstring, too-few-public-methods, invalid-name diff --git a/tests/functional/r/regression_02/regression_4982.py b/tests/functional/r/regression_02/regression_4982.py index a6cef6f9e..27e8d08a1 100644 --- a/tests/functional/r/regression_02/regression_4982.py +++ b/tests/functional/r/regression_02/regression_4982.py @@ -1,4 +1,4 @@ -"""Regression test for a crash reported in https://github.com/PyCQA/pylint/issues/4982""" +"""Regression test for a crash reported in https://github.com/pylint-dev/pylint/issues/4982""" # pylint: disable=too-few-public-methods class Base: diff --git a/tests/functional/r/regression_02/regression_5030.py b/tests/functional/r/regression_02/regression_5030.py index 8aa22f879..46842dc68 100644 --- a/tests/functional/r/regression_02/regression_5030.py +++ b/tests/functional/r/regression_02/regression_5030.py @@ -1,11 +1,11 @@ """Regression in astroid on ClassDef inference with two test cases. -Fixed in https://github.com/PyCQA/astroid/pull/1181""" +Fixed in https://github.com/pylint-dev/astroid/pull/1181""" from typing import Tuple, Type from typing import Dict, List, Any from dataclasses import dataclass, field -# https://github.com/PyCQA/pylint/issues/5030 +# https://github.com/pylint-dev/pylint/issues/5030 def is_type_list(f_type: Type) -> bool: """just here to show the issue""" return f_type == list @@ -13,7 +13,7 @@ def is_type_list(f_type: Type) -> bool: assert not is_type_list(Tuple) -# https://github.com/PyCQA/pylint/issues/5036 +# https://github.com/pylint-dev/pylint/issues/5036 @dataclass class SomeData: """A dataclass.""" diff --git a/tests/functional/r/regression_02/regression_5048.py b/tests/functional/r/regression_02/regression_5048.py index 08ff55fb2..9cf11baf7 100644 --- a/tests/functional/r/regression_02/regression_5048.py +++ b/tests/functional/r/regression_02/regression_5048.py @@ -1,9 +1,9 @@ """Crash regression in astroid on Compare node inference -Fixed in https://github.com/PyCQA/astroid/pull/1185""" +Fixed in https://github.com/pylint-dev/astroid/pull/1185""" # pylint: disable=missing-docstring, broad-exception-raised -# Reported at https://github.com/PyCQA/pylint/issues/5048 +# Reported at https://github.com/pylint-dev/pylint/issues/5048 def func(parameter): if tuple() + (parameter[1],) in set(): raise Exception() diff --git a/tests/functional/r/regression_02/regression_5244.py b/tests/functional/r/regression_02/regression_5244.py index 248c4a4a1..1bc811ca5 100644 --- a/tests/functional/r/regression_02/regression_5244.py +++ b/tests/functional/r/regression_02/regression_5244.py @@ -1,5 +1,5 @@ """Test for the regression on inference of self referential __len__ -Reported in https://github.com/PyCQA/pylint/issues/5244 +Reported in https://github.com/pylint-dev/pylint/issues/5244 """ # pylint: disable=missing-class-docstring, missing-function-docstring diff --git a/tests/functional/r/regression_02/regression_5408.py b/tests/functional/r/regression_02/regression_5408.py index b9bcdb9e8..93dcc81e1 100644 --- a/tests/functional/r/regression_02/regression_5408.py +++ b/tests/functional/r/regression_02/regression_5408.py @@ -1,7 +1,7 @@ """Regression test for issue 5408. Recursion error for self-referencing class attribute. -See: https://github.com/PyCQA/pylint/issues/5408 +See: https://github.com/pylint-dev/pylint/issues/5408 """ # pylint: disable=missing-docstring, too-few-public-methods, invalid-name, inherit-non-class diff --git a/tests/functional/r/regression_02/regression_5461.py b/tests/functional/r/regression_02/regression_5461.py index 39daf7b9b..9344782c0 100644 --- a/tests/functional/r/regression_02/regression_5461.py +++ b/tests/functional/r/regression_02/regression_5461.py @@ -1,6 +1,6 @@ """Regression test for issue 5461 Crash on list comprehension with it used `type` as variable name -See: https://github.com/PyCQA/pylint/issues/5461 +See: https://github.com/pylint-dev/pylint/issues/5461 """ var = [type for type in [] if type["id"]] diff --git a/tests/functional/r/regression_02/regression_5479.py b/tests/functional/r/regression_02/regression_5479.py index adc20f26c..9955ea680 100644 --- a/tests/functional/r/regression_02/regression_5479.py +++ b/tests/functional/r/regression_02/regression_5479.py @@ -1,5 +1,5 @@ """Test for a regression on slots and annotated assignments. -Reported in https://github.com/PyCQA/pylint/issues/5479 +Reported in https://github.com/pylint-dev/pylint/issues/5479 """ # pylint: disable=too-few-public-methods, unused-private-member, missing-class-docstring, missing-function-docstring diff --git a/tests/functional/r/regression_02/regression_5776.py b/tests/functional/r/regression_02/regression_5776.py index 5e8342511..00be9ad46 100644 --- a/tests/functional/r/regression_02/regression_5776.py +++ b/tests/functional/r/regression_02/regression_5776.py @@ -1,6 +1,6 @@ """Test for a regression with Enums not being recognized when imported with an alias. -Reported in https://github.com/PyCQA/pylint/issues/5776 +Reported in https://github.com/pylint-dev/pylint/issues/5776 """ from enum import Enum as PyEnum diff --git a/tests/functional/r/regression_02/regression_5801.py b/tests/functional/r/regression_02/regression_5801.py index 8c08ec675..8b6c18ec8 100644 --- a/tests/functional/r/regression_02/regression_5801.py +++ b/tests/functional/r/regression_02/regression_5801.py @@ -1,4 +1,4 @@ -# https://github.com/PyCQA/pylint/issues/5801 +# https://github.com/pylint-dev/pylint/issues/5801 # pylint: disable=missing-docstring import struct diff --git a/tests/functional/r/regression_02/regression_8109.py b/tests/functional/r/regression_02/regression_8109.py index f5cf8b142..69af0356a 100644 --- a/tests/functional/r/regression_02/regression_8109.py +++ b/tests/functional/r/regression_02/regression_8109.py @@ -1,4 +1,4 @@ -"""Regression test for https://github.com/PyCQA/pylint/issues/8109.""" +"""Regression test for https://github.com/pylint-dev/pylint/issues/8109.""" # pylint: disable=missing-docstring, unsupported-binary-operation diff --git a/tests/functional/r/regression_02/regression_8109.txt b/tests/functional/r/regression_02/regression_8109.txt index 161925b7d..b3166d608 100644 --- a/tests/functional/r/regression_02/regression_8109.txt +++ b/tests/functional/r/regression_02/regression_8109.txt @@ -1 +1 @@ -consider-using-f-string:14:24:14:34:Number.__str__:Formatting a regular string which could be a f-string:UNDEFINED +consider-using-f-string:14:24:14:34:Number.__str__:Formatting a regular string which could be an f-string:UNDEFINED diff --git a/tests/functional/r/regression_02/regression_distutil_import_error_73.py b/tests/functional/r/regression_02/regression_distutil_import_error_73.py index d40c0973f..ddd96b65e 100644 --- a/tests/functional/r/regression_02/regression_distutil_import_error_73.py +++ b/tests/functional/r/regression_02/regression_distutil_import_error_73.py @@ -1,10 +1,10 @@ """ Regression test to check that distutils can be imported -See https://github.com/PyCQA/pylint/issues/73 +See https://github.com/pylint-dev/pylint/issues/73 See also: -https://github.com/PyCQA/pylint/issues/2955 -https://github.com/PyCQA/astroid/pull/1321 +https://github.com/pylint-dev/pylint/issues/2955 +https://github.com/pylint-dev/astroid/pull/1321 """ # pylint: disable=unused-import, deprecated-module diff --git a/tests/functional/r/regression_02/regression_enum_1734.py b/tests/functional/r/regression_02/regression_enum_1734.py index 06759c7d3..128ab81e5 100644 --- a/tests/functional/r/regression_02/regression_enum_1734.py +++ b/tests/functional/r/regression_02/regression_enum_1734.py @@ -1,6 +1,6 @@ -# Regression test for https://github.com/PyCQA/astroid/pull/1734 +# Regression test for https://github.com/pylint-dev/astroid/pull/1734 # The following should lint just fine -# Fixed in https://github.com/PyCQA/astroid/pull/1743 +# Fixed in https://github.com/pylint-dev/astroid/pull/1743 # pylint: disable=missing-docstring,invalid-name diff --git a/tests/functional/r/regression_02/regression_no_member_7631.py b/tests/functional/r/regression_02/regression_no_member_7631.py index 758aad057..6329187f7 100644 --- a/tests/functional/r/regression_02/regression_no_member_7631.py +++ b/tests/functional/r/regression_02/regression_no_member_7631.py @@ -1,4 +1,4 @@ -"""Regression test from https://github.com/PyCQA/pylint/issues/7631 +"""Regression test from https://github.com/pylint-dev/pylint/issues/7631 The following code should NOT raise no-member. """ # pylint: disable=missing-docstring,too-few-public-methods diff --git a/tests/functional/r/regression_02/regression_node_statement_two.py b/tests/functional/r/regression_02/regression_node_statement_two.py index b54ed99bb..ad4afd947 100644 --- a/tests/functional/r/regression_02/regression_node_statement_two.py +++ b/tests/functional/r/regression_02/regression_node_statement_two.py @@ -1,6 +1,6 @@ """Test to see we don't crash on this code in pandas. See: https://github.com/pandas-dev/pandas/blob/master/pandas/core/indexes/period.py -Reported in https://github.com/PyCQA/pylint/issues/5382 +Reported in https://github.com/pylint-dev/pylint/issues/5382 """ # pylint: disable=missing-function-docstring, missing-class-docstring, unused-argument # pylint: disable=too-few-public-methods, no-method-argument, invalid-name diff --git a/tests/functional/r/regression/regression_property_slots_2439.py b/tests/functional/r/regression_02/regression_property_slots_2439.py index 91cf86cfd..43882b3ac 100644 --- a/tests/functional/r/regression/regression_property_slots_2439.py +++ b/tests/functional/r/regression_02/regression_property_slots_2439.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring,invalid-name,too-few-public-methods -# https://github.com/PyCQA/pylint/issues/2439 +# https://github.com/pylint-dev/pylint/issues/2439 class TestClass: __slots__ = ["_i"] diff --git a/tests/functional/r/regression_02/regression_too_many_arguments_2335.py b/tests/functional/r/regression_02/regression_too_many_arguments_2335.py index 55aa87308..896bb320e 100644 --- a/tests/functional/r/regression_02/regression_too_many_arguments_2335.py +++ b/tests/functional/r/regression_02/regression_too_many_arguments_2335.py @@ -1,6 +1,6 @@ """Test that `abc.ABCMeta.__new__` does not trigger too-many-function-arguments when referred -https://github.com/PyCQA/pylint/issues/2335 +https://github.com/pylint-dev/pylint/issues/2335 """ # pylint: disable=missing-class-docstring,unused-argument,arguments-differ from abc import ABCMeta diff --git a/tests/functional/s/singledispatch_functions.py b/tests/functional/s/singledispatch/singledispatch_functions.py index 931bfd30d..931bfd30d 100644 --- a/tests/functional/s/singledispatch_functions.py +++ b/tests/functional/s/singledispatch/singledispatch_functions.py diff --git a/tests/functional/s/singledispatch_functions.txt b/tests/functional/s/singledispatch/singledispatch_functions.txt index 93fc30496..93fc30496 100644 --- a/tests/functional/s/singledispatch_functions.txt +++ b/tests/functional/s/singledispatch/singledispatch_functions.txt diff --git a/tests/functional/s/singledispatch_method.txt b/tests/functional/s/singledispatch/singledispatch_method.txt index c747fb6a8..c747fb6a8 100644 --- a/tests/functional/s/singledispatch_method.txt +++ b/tests/functional/s/singledispatch/singledispatch_method.txt diff --git a/tests/functional/s/singledispatch_method_py37.py b/tests/functional/s/singledispatch/singledispatch_method_py37.py index c9269f7bf..c9269f7bf 100644 --- a/tests/functional/s/singledispatch_method_py37.py +++ b/tests/functional/s/singledispatch/singledispatch_method_py37.py diff --git a/tests/functional/s/singledispatch/singledispatch_method_py37.rc b/tests/functional/s/singledispatch/singledispatch_method_py37.rc new file mode 100644 index 000000000..77eb3be64 --- /dev/null +++ b/tests/functional/s/singledispatch/singledispatch_method_py37.rc @@ -0,0 +1,2 @@ +[main] +py-version=3.7 diff --git a/tests/functional/s/singledispatch_method_py37.txt b/tests/functional/s/singledispatch/singledispatch_method_py37.txt index 111bc4722..111bc4722 100644 --- a/tests/functional/s/singledispatch_method_py37.txt +++ b/tests/functional/s/singledispatch/singledispatch_method_py37.txt diff --git a/tests/functional/s/singledispatch_method_py38.py b/tests/functional/s/singledispatch/singledispatch_method_py38.py index ad8eea1dd..ad8eea1dd 100644 --- a/tests/functional/s/singledispatch_method_py38.py +++ b/tests/functional/s/singledispatch/singledispatch_method_py38.py diff --git a/tests/functional/s/singledispatchmethod_function_py38.rc b/tests/functional/s/singledispatch/singledispatch_method_py38.rc index 85fc502b3..85fc502b3 100644 --- a/tests/functional/s/singledispatchmethod_function_py38.rc +++ b/tests/functional/s/singledispatch/singledispatch_method_py38.rc diff --git a/tests/functional/s/singledispatch_method_py38.txt b/tests/functional/s/singledispatch/singledispatch_method_py38.txt index c747fb6a8..c747fb6a8 100644 --- a/tests/functional/s/singledispatch_method_py38.txt +++ b/tests/functional/s/singledispatch/singledispatch_method_py38.txt diff --git a/tests/functional/s/singledispatchmethod_function_py38.py b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.py index ef44f71c1..ef44f71c1 100644 --- a/tests/functional/s/singledispatchmethod_function_py38.py +++ b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.py diff --git a/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc new file mode 100644 index 000000000..85fc502b3 --- /dev/null +++ b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.8 diff --git a/tests/functional/s/singledispatchmethod_function_py38.txt b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.txt index 4c236b346..4c236b346 100644 --- a/tests/functional/s/singledispatchmethod_function_py38.txt +++ b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.txt diff --git a/tests/functional/s/singledispatch_method_py37.rc b/tests/functional/s/singledispatch_method_py37.rc deleted file mode 100644 index 67a28a36a..000000000 --- a/tests/functional/s/singledispatch_method_py37.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.8 diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.rc b/tests/functional/s/star/star_needs_assignment_target_py37.rc deleted file mode 100644 index 67a28a36a..000000000 --- a/tests/functional/s/star/star_needs_assignment_target_py37.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.8 diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.py b/tests/functional/s/star/star_needs_assignment_target_py38.py index fb5eea86a..fb5eea86a 100644 --- a/tests/functional/s/star/star_needs_assignment_target_py37.py +++ b/tests/functional/s/star/star_needs_assignment_target_py38.py diff --git a/tests/functional/s/star/star_needs_assignment_target_py38.rc b/tests/functional/s/star/star_needs_assignment_target_py38.rc new file mode 100644 index 000000000..d584aa959 --- /dev/null +++ b/tests/functional/s/star/star_needs_assignment_target_py38.rc @@ -0,0 +1,2 @@ +[testoptions] +max_pyver=3.9 diff --git a/tests/functional/s/star/star_needs_assignment_target_py37.txt b/tests/functional/s/star/star_needs_assignment_target_py38.txt index fb5a5faa6..fb5a5faa6 100644 --- a/tests/functional/s/star/star_needs_assignment_target_py37.txt +++ b/tests/functional/s/star/star_needs_assignment_target_py38.txt diff --git a/tests/functional/s/stop_iteration_inside_generator.py b/tests/functional/s/stop_iteration_inside_generator.py index efde61a77..fcd20a683 100644 --- a/tests/functional/s/stop_iteration_inside_generator.py +++ b/tests/functional/s/stop_iteration_inside_generator.py @@ -100,25 +100,25 @@ def gen_dont_crash_on_no_exception(): def gen_dont_crash_on_uninferable(): - # https://github.com/PyCQA/pylint/issues/1779 + # https://github.com/pylint-dev/pylint/issues/1779 yield from iter() raise asyncio.TimeoutError() -# https://github.com/PyCQA/pylint/issues/1830 +# https://github.com/pylint-dev/pylint/issues/1830 def gen_next_with_sentinel(): yield next([], 42) # No bad return from itertools import count, cycle -# https://github.com/PyCQA/pylint/issues/2158 +# https://github.com/pylint-dev/pylint/issues/2158 def generator_using_next(): counter = count() number = next(counter) yield number * 2 -# https://github.com/PyCQA/pylint/issues/7765 +# https://github.com/pylint-dev/pylint/issues/7765 def infinite_iterator_itertools_cycle(): counter = cycle('ABCD') val = next(counter) @@ -179,7 +179,7 @@ def other_safeiter(it): def data(filename): """ Ensure pylint doesn't crash if `next` is incorrectly called without args - See https://github.com/PyCQA/pylint/issues/7828 + See https://github.com/pylint-dev/pylint/issues/7828 """ with open(filename, encoding="utf8") as file: next() # attempt to skip header but this is incorrect code diff --git a/tests/functional/s/subclassed_final_class_py38.py b/tests/functional/s/subclassed_final_class_py38.py index a4621d532..76f4d617e 100644 --- a/tests/functional/s/subclassed_final_class_py38.py +++ b/tests/functional/s/subclassed_final_class_py38.py @@ -4,7 +4,7 @@ subclassed.""" # pylint: disable=missing-docstring, too-few-public-methods # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from typing import final diff --git a/tests/functional/s/super/super_checks.py b/tests/functional/s/super/super_checks.py index 050fd3c81..2c8515b12 100644 --- a/tests/functional/s/super/super_checks.py +++ b/tests/functional/s/super/super_checks.py @@ -99,7 +99,7 @@ class InvalidSuperChecks(BaseClass): -# Regression for PyCQA/pylint/issues/773 +# Regression for pylint-dev/pylint/issues/773 import subprocess # The problem was related to astroid not filtering statements @@ -125,7 +125,7 @@ class SuperWithSelfClass: super(self.__class__, self).__init__() # [bad-super-call] -# Reported in https://github.com/PyCQA/pylint/issues/2903 +# Reported in https://github.com/pylint-dev/pylint/issues/2903 class Parent: def method(self): print() @@ -149,7 +149,7 @@ class GrandChild(Child): super(Niece, self).method() # [bad-super-call] -# Reported in https://github.com/PyCQA/pylint/issues/4922 +# Reported in https://github.com/pylint-dev/pylint/issues/4922 class AlabamaCousin(Child, Niece): def method(self): print("AlabamaCousin") diff --git a/tests/functional/s/super/super_init_not_called.py b/tests/functional/s/super/super_init_not_called.py index f0bfe0329..03bfd3b43 100644 --- a/tests/functional/s/super/super_init_not_called.py +++ b/tests/functional/s/super/super_init_not_called.py @@ -52,14 +52,14 @@ class ChildThree(ParentWithoutInit): # Regression test as reported in -# https://github.com/PyCQA/pylint/issues/6027 +# https://github.com/pylint-dev/pylint/issues/6027 class MyUnion(ctypes.Union): def __init__(self): pass # Should not be called on abstract __init__ methods -# https://github.com/PyCQA/pylint/issues/3975 +# https://github.com/pylint-dev/pylint/issues/3975 class Base: def __init__(self, param: int, param_two: str) -> None: raise NotImplementedError() diff --git a/tests/functional/s/sys_stream_regression_1004.py b/tests/functional/s/sys_stream_regression_1004.py index c0391859d..546552af9 100644 --- a/tests/functional/s/sys_stream_regression_1004.py +++ b/tests/functional/s/sys_stream_regression_1004.py @@ -1,4 +1,4 @@ -'''Regression for issue https://github.com/PyCQA/pylint/issues/1004''' +'''Regression for issue https://github.com/pylint-dev/pylint/issues/1004''' # pylint: disable=missing-docstring, pointless-statement import sys diff --git a/tests/functional/t/too/too_few_public_methods_37.py b/tests/functional/t/too/too_few_public_methods_37.py index 3b63a8fec..db9c9f171 100644 --- a/tests/functional/t/too/too_few_public_methods_37.py +++ b/tests/functional/t/too/too_few_public_methods_37.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements import dataclasses diff --git a/tests/functional/t/too/too_many_ancestors.py b/tests/functional/t/too/too_many_ancestors.py index a460e4f16..cd83492b3 100644 --- a/tests/functional/t/too/too_many_ancestors.py +++ b/tests/functional/t/too/too_many_ancestors.py @@ -25,8 +25,8 @@ class Jjjj(Iiii): # [too-many-ancestors] pass -# https://github.com/PyCQA/pylint/issues/4166 -# https://github.com/PyCQA/pylint/issues/4415 +# https://github.com/pylint-dev/pylint/issues/4166 +# https://github.com/pylint-dev/pylint/issues/4415 class ItemSequence(MutableSequence): """Minimal MutableSequence.""" def __getitem__(self, key): diff --git a/tests/functional/t/too/too_many_arguments.py b/tests/functional/t/too/too_many_arguments.py index 8d26902af..f4a668f53 100644 --- a/tests/functional/t/too/too_many_arguments.py +++ b/tests/functional/t/too/too_many_arguments.py @@ -26,7 +26,7 @@ def root_function(first, second, third): def func_call(): - """Test we don't emit a FP for https://github.com/PyCQA/pylint/issues/2588""" + """Test we don't emit a FP for https://github.com/pylint-dev/pylint/issues/2588""" partial_func = partial(root_function, 1, 2, 3) partial_func() return root_function(1, 2, 3) diff --git a/tests/functional/t/too/too_many_function_args.py b/tests/functional/t/too/too_many_function_args.py index c5ca4f78e..9ba49565e 100644 --- a/tests/functional/t/too/too_many_function_args.py +++ b/tests/functional/t/too/too_many_function_args.py @@ -1,4 +1,4 @@ -"""https://github.com/PyCQA/pylint/issues/3675""" +"""https://github.com/pylint-dev/pylint/issues/3675""" def noop(x): # pylint: disable=invalid-name diff --git a/tests/functional/t/too/too_many_instance_attributes.py b/tests/functional/t/too/too_many_instance_attributes.py index 3177dc8aa..a41f3ea88 100644 --- a/tests/functional/t/too/too_many_instance_attributes.py +++ b/tests/functional/t/too/too_many_instance_attributes.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring, too-few-public-methods # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements diff --git a/tests/functional/t/too/too_many_instance_attributes_py37.py b/tests/functional/t/too/too_many_instance_attributes_py37.py index 152bb1ca2..1ab262b87 100644 --- a/tests/functional/t/too/too_many_instance_attributes_py37.py +++ b/tests/functional/t/too/too_many_instance_attributes_py37.py @@ -6,7 +6,7 @@ Default max_instance_attributes is 7 # pylint: disable=missing-docstring, too-few-public-methods # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from dataclasses import dataclass, InitVar diff --git a/tests/functional/t/trailing_whitespaces.py b/tests/functional/t/trailing_whitespaces.py index c88b7ea62..9866398ee 100644 --- a/tests/functional/t/trailing_whitespaces.py +++ b/tests/functional/t/trailing_whitespaces.py @@ -9,7 +9,7 @@ print('windows line ends are ok') # +1: [trailing-whitespace] print('but trailing whitespace on win is not') -# Regression test for https://github.com/PyCQA/pylint/issues/6936 +# Regression test for https://github.com/pylint-dev/pylint/issues/6936 # +2: [trailing-whitespace] """ This module has the Board class. """ @@ -19,7 +19,7 @@ print('but trailing whitespace on win is not') It's a very nice Board. """ -# Regression test for https://github.com/PyCQA/pylint/issues/3822 +# Regression test for https://github.com/pylint-dev/pylint/issues/3822 def example(*args): """Example function.""" print(*args) diff --git a/tests/functional/t/typealias_naming_style_default.py b/tests/functional/t/typealias_naming_style_default.py index 8baabb49c..6a2c81569 100644 --- a/tests/functional/t/typealias_naming_style_default.py +++ b/tests/functional/t/typealias_naming_style_default.py @@ -31,3 +31,14 @@ x: Union[str, int] = 42 y: Union[str, int] # But the following, using a good TypeAlias name, is: GoodTypeAliasToUnion: TypeAlias = Union[str, int] + + +def my_function(): + """My doc.""" + LocalGoodName: TypeAlias = int + local_bad_name: TypeAlias = int # [invalid-name] + local_declaration: Union[str, int] + LocalTypeAliasToUnion: TypeAlias = Union[str, int] + local_declaration = 1 + del local_declaration + del LocalGoodName, local_bad_name, LocalTypeAliasToUnion diff --git a/tests/functional/t/typealias_naming_style_default.txt b/tests/functional/t/typealias_naming_style_default.txt index 455cbc213..24090841f 100644 --- a/tests/functional/t/typealias_naming_style_default.txt +++ b/tests/functional/t/typealias_naming_style_default.txt @@ -9,3 +9,4 @@ invalid-name:23:0:23:9::"Type alias name ""_BAD_NAME"" doesn't conform to predef invalid-name:24:0:24:10::"Type alias name ""__BAD_NAME"" doesn't conform to predefined naming style":HIGH invalid-name:25:0:25:9::"Type alias name ""_1BadName"" doesn't conform to predefined naming style":HIGH invalid-name:26:0:26:14::"Type alias name ""ANOTHERBADNAME"" doesn't conform to predefined naming style":HIGH +invalid-name:39:4:39:18:my_function:"Type alias name ""local_bad_name"" doesn't conform to predefined naming style":HIGH diff --git a/tests/functional/t/typedDict.py b/tests/functional/t/typedDict.py index 3ce96b256..31cad0b28 100644 --- a/tests/functional/t/typedDict.py +++ b/tests/functional/t/typedDict.py @@ -25,7 +25,7 @@ my_dict["var"] my_dict["var"] = 2 -# https://github.com/PyCQA/pylint/issues/4715 +# https://github.com/pylint-dev/pylint/issues/4715 # Instance of TypedDict should be callable Link = TypedDict("Link", {"href": str}) Link(href="foo") diff --git a/tests/functional/t/typing_generic.py b/tests/functional/t/typing_generic.py index 4b2985e0d..66b8ce4fc 100644 --- a/tests/functional/t/typing_generic.py +++ b/tests/functional/t/typing_generic.py @@ -1,6 +1,6 @@ # pylint: disable=missing-docstring,invalid-name,too-few-public-methods -# https://github.com/PyCQA/pylint/issues/2822 +# https://github.com/pylint-dev/pylint/issues/2822 # Base should be subscriptable, even with ABCMeta as metaclass from abc import ABC, ABCMeta from typing import Generic, TypeVar @@ -14,7 +14,7 @@ class Impl(Base[str]): """Impl""" -# https://github.com/PyCQA/astroid/issues/942 +# https://github.com/pylint-dev/astroid/issues/942 Anything = TypeVar("Anything") MoreSpecific = TypeVar("MoreSpecific", str, int) diff --git a/tests/functional/u/unbalanced_dict_unpacking.py b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.py index 2c4d3b103..2c4d3b103 100644 --- a/tests/functional/u/unbalanced_dict_unpacking.py +++ b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.py diff --git a/tests/functional/u/unbalanced_dict_unpacking.txt b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt index b31d89b40..b31d89b40 100644 --- a/tests/functional/u/unbalanced_dict_unpacking.txt +++ b/tests/functional/u/unbalanced/unbalanced_dict_unpacking.txt diff --git a/tests/functional/u/unbalanced_tuple_unpacking.py b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py index 226748933..21e497be8 100644 --- a/tests/functional/u/unbalanced_tuple_unpacking.py +++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.py @@ -158,5 +158,5 @@ a, b = my_function("12") # [unbalanced-tuple-unpacking] c = my_function("12") d, *_ = my_function("12") -# https://github.com/PyCQA/pylint/issues/5998 +# https://github.com/pylint-dev/pylint/issues/5998 x, y, z = (1, 2) # [unbalanced-tuple-unpacking] diff --git a/tests/functional/u/unbalanced_tuple_unpacking.txt b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt index 651e09840..651e09840 100644 --- a/tests/functional/u/unbalanced_tuple_unpacking.txt +++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking.txt diff --git a/tests/functional/u/unbalanced_tuple_unpacking_py30.py b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py index c45cccdd1..c45cccdd1 100644 --- a/tests/functional/u/unbalanced_tuple_unpacking_py30.py +++ b/tests/functional/u/unbalanced/unbalanced_tuple_unpacking_py30.py diff --git a/tests/functional/u/undefined/undefined_loop_variable.py b/tests/functional/u/undefined/undefined_loop_variable.py index 9d5cf4111..10d6dc60b 100644 --- a/tests/functional/u/undefined/undefined_loop_variable.py +++ b/tests/functional/u/undefined/undefined_loop_variable.py @@ -1,11 +1,6 @@ # pylint: disable=missing-docstring,redefined-builtin, consider-using-f-string, unnecessary-direct-lambda-call, broad-exception-raised -import sys - -if sys.version_info >= (3, 8): - from typing import NoReturn -else: - from typing_extensions import NoReturn +from typing import NoReturn def do_stuff(some_random_list): @@ -84,7 +79,7 @@ def do_stuff_with_redefined_range(): def test(content): - # https://github.com/PyCQA/pylint/issues/3711 + # https://github.com/pylint-dev/pylint/issues/3711 def handle_line(layne): if "X" in layne: layne = layne.replace("X", "Y") @@ -160,7 +155,7 @@ bigger = [ def lambda_in_first_of_two_loops(): - """https://github.com/PyCQA/pylint/issues/6419""" + """https://github.com/pylint-dev/pylint/issues/6419""" my_list = [] for thing in my_list: print_it = lambda: print(thing) # pylint: disable=cell-var-from-loop, unnecessary-lambda-assignment @@ -180,21 +175,21 @@ def variable_name_assigned_in_body_of_second_loop(): def use_enumerate(): - """https://github.com/PyCQA/pylint/issues/6593""" + """https://github.com/pylint-dev/pylint/issues/6593""" for i, num in enumerate(range(3)): pass print(i, num) def use_enumerate_in_ternary_expression(): - """https://github.com/PyCQA/pylint/issues/7131""" + """https://github.com/pylint-dev/pylint/issues/7131""" for i, num in enumerate(range(3)) if __revision__ else enumerate(range(4)): pass print(i, num) def find_even_number(container): - """https://github.com/PyCQA/pylint/pull/6923#discussion_r895134495""" + """https://github.com/pylint-dev/pylint/pull/6923#discussion_r895134495""" for something in container: if something % 2 == 0: break diff --git a/tests/functional/u/undefined/undefined_loop_variable.txt b/tests/functional/u/undefined/undefined_loop_variable.txt index e10c9e002..78dc602ed 100644 --- a/tests/functional/u/undefined/undefined_loop_variable.txt +++ b/tests/functional/u/undefined/undefined_loop_variable.txt @@ -1,4 +1,4 @@ -undefined-loop-variable:14:11:14:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED -undefined-loop-variable:33:7:33:11::Using possibly undefined loop variable 'var1':UNDEFINED -undefined-loop-variable:83:11:83:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED -undefined-loop-variable:201:11:201:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED +undefined-loop-variable:9:11:9:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED +undefined-loop-variable:28:7:28:11::Using possibly undefined loop variable 'var1':UNDEFINED +undefined-loop-variable:78:11:78:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED +undefined-loop-variable:196:11:196:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED diff --git a/tests/functional/u/undefined/undefined_loop_variable_py38.py b/tests/functional/u/undefined/undefined_loop_variable_py38.py index 5778df7d2..f9bd06f62 100644 --- a/tests/functional/u/undefined/undefined_loop_variable_py38.py +++ b/tests/functional/u/undefined/undefined_loop_variable_py38.py @@ -2,7 +2,7 @@ def walrus_in_comprehension_test(container): - """https://github.com/PyCQA/pylint/issues/7222""" + """https://github.com/pylint-dev/pylint/issues/7222""" for something in container: print(something) print([my_test for something in container if (my_test := something)]) diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py index 78a32dacc..e1b66910f 100644 --- a/tests/functional/u/undefined/undefined_variable.py +++ b/tests/functional/u/undefined/undefined_variable.py @@ -203,7 +203,7 @@ def dec(inp): # referencing parent class do not raise undefined variable # because at the time of their calling, the class name will # be populated -# See https://github.com/PyCQA/pylint/issues/704 +# See https://github.com/pylint-dev/pylint/issues/704 class LambdaClass: myattr = 1 mylambda = lambda: LambdaClass.myattr @@ -346,7 +346,7 @@ def decorated4(x): print(x) -# https://github.com/PyCQA/pylint/issues/5111 +# https://github.com/pylint-dev/pylint/issues/5111 # AssignAttr in orelse block of 'TYPE_CHECKING' shouldn't crash # Name being assigned must be imported in orelse block if TYPE_CHECKING: diff --git a/tests/functional/u/undefined/undefined_variable.txt b/tests/functional/u/undefined/undefined_variable.txt index ab1a00420..b41f9ae46 100644 --- a/tests/functional/u/undefined/undefined_variable.txt +++ b/tests/functional/u/undefined/undefined_variable.txt @@ -27,7 +27,7 @@ undefined-variable:166:4:166:13::Undefined variable 'unicode_2':UNDEFINED undefined-variable:171:4:171:13::Undefined variable 'unicode_3':UNDEFINED undefined-variable:226:25:226:37:LambdaClass4.<lambda>:Undefined variable 'LambdaClass4':UNDEFINED undefined-variable:234:25:234:37:LambdaClass5.<lambda>:Undefined variable 'LambdaClass5':UNDEFINED -used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:HIGH +used-before-assignment:255:26:255:34:func_should_fail:Using variable 'datetime' before assignment:CONTROL_FLOW undefined-variable:291:18:291:24:not_using_loop_variable_accordingly:Undefined variable 'iteree':UNDEFINED undefined-variable:308:27:308:28:undefined_annotation:Undefined variable 'x':UNDEFINED used-before-assignment:309:7:309:8:undefined_annotation:Using variable 'x' before assignment:HIGH diff --git a/tests/functional/u/undefined/undefined_variable_classes.py b/tests/functional/u/undefined/undefined_variable_classes.py index 364e24942..64d0007a5 100644 --- a/tests/functional/u/undefined/undefined_variable_classes.py +++ b/tests/functional/u/undefined/undefined_variable_classes.py @@ -2,7 +2,7 @@ # pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods # Test that list comprehensions in base classes are scoped correctly -# Regression reported in https://github.com/PyCQA/pylint/issues/3434 +# Regression reported in https://github.com/pylint-dev/pylint/issues/3434 import collections @@ -14,7 +14,7 @@ class Foo(collections.namedtuple("Foo", [x + "_foo" for x in l])): # Test that class attributes are in scope for return type annotations. -# Regression reported in https://github.com/PyCQA/pylint/issues/1976 +# Regression reported in https://github.com/pylint-dev/pylint/issues/1976 class MyObject: class MyType: pass diff --git a/tests/functional/u/undefined/undefined_variable_decorators.py b/tests/functional/u/undefined/undefined_variable_decorators.py index 359737289..77c0b1229 100644 --- a/tests/functional/u/undefined/undefined_variable_decorators.py +++ b/tests/functional/u/undefined/undefined_variable_decorators.py @@ -3,7 +3,7 @@ # pylint: disable=unnecessary-comprehension # Test that class attributes are in scope for listcomp in decorator. -# Regression reported in https://github.com/PyCQA/pylint/issues/511 +# Regression reported in https://github.com/pylint-dev/pylint/issues/511 def dec(inp): def inner(func): diff --git a/tests/functional/u/undefined/undefined_variable_py30.py b/tests/functional/u/undefined/undefined_variable_py30.py index ff77aaf8e..723e275a0 100644 --- a/tests/functional/u/undefined/undefined_variable_py30.py +++ b/tests/functional/u/undefined/undefined_variable_py30.py @@ -87,7 +87,7 @@ def used_before_assignment(*, arg): return arg + 1 # Test for #4021 -# https://github.com/PyCQA/pylint/issues/4021 +# https://github.com/pylint-dev/pylint/issues/4021 class MetaClass(type): def __new__(mcs, *args, parameter=None, **kwargs): print(parameter) @@ -99,7 +99,7 @@ class InheritingClass(metaclass=MetaClass, parameter=variable): # [undefined-va # Test for #4031 -# https://github.com/PyCQA/pylint/issues/4031 +# https://github.com/pylint-dev/pylint/issues/4031 class Inheritor(metaclass=DefinedTooLate ): # [undefined-variable] pass diff --git a/tests/functional/u/undefined/undefined_variable_py38.py b/tests/functional/u/undefined/undefined_variable_py38.py index 6fb543e80..1f69a18a8 100644 --- a/tests/functional/u/undefined/undefined_variable_py38.py +++ b/tests/functional/u/undefined/undefined_variable_py38.py @@ -120,7 +120,7 @@ sorted_things = sorted( # Tests for type annotation reused in comprehension def type_annotation_used_after_comprehension(): - """https://github.com/PyCQA/pylint/issues/5326#issuecomment-982635371""" + """https://github.com/pylint-dev/pylint/issues/5326#issuecomment-982635371""" my_int: int ints = [my_int + 1 for my_int in range(5)] @@ -129,13 +129,13 @@ def type_annotation_used_after_comprehension(): def type_annotation_unused_after_comprehension(): - """https://github.com/PyCQA/pylint/issues/5326""" + """https://github.com/pylint-dev/pylint/issues/5326""" my_int: int _ = [print(sep=my_int, end=my_int) for my_int in range(10)] def type_annotation_used_improperly_after_comprehension(): - """https://github.com/PyCQA/pylint/issues/5654""" + """https://github.com/pylint-dev/pylint/issues/5654""" my_int: int _ = [print(sep=my_int, end=my_int) for my_int in range(10)] print(my_int) # [used-before-assignment] diff --git a/tests/functional/u/undefined/undefined_variable_typing.py b/tests/functional/u/undefined/undefined_variable_typing.py index 7ef4d8599..fda65ceca 100644 --- a/tests/functional/u/undefined/undefined_variable_typing.py +++ b/tests/functional/u/undefined/undefined_variable_typing.py @@ -2,7 +2,7 @@ # pylint: disable=invalid-name, import-error # Ensure attribute lookups in type comments are accounted for. -# Reported in https://github.com/PyCQA/pylint/issues/4603 +# Reported in https://github.com/pylint-dev/pylint/issues/4603 from typing import TYPE_CHECKING, Any, Dict @@ -16,12 +16,12 @@ c = ... # type: Bar.Boo if TYPE_CHECKING: __additional_builtin__: Dict[str, Any] - # For why this would emit redefined-builtin: https://github.com/PyCQA/pylint/pull/3643 + # For why this would emit redefined-builtin: https://github.com/pylint-dev/pylint/pull/3643 # pylint: disable-next=redefined-builtin repr: Any def run(): - """https://github.com/PyCQA/pylint/issues/6388""" + """https://github.com/pylint-dev/pylint/issues/6388""" print(repr) return __additional_builtin__["test"] diff --git a/tests/functional/u/unexpected_special_method_signature.py b/tests/functional/u/unexpected_special_method_signature.py index e2ae33857..146308b03 100644 --- a/tests/functional/u/unexpected_special_method_signature.py +++ b/tests/functional/u/unexpected_special_method_signature.py @@ -128,7 +128,7 @@ class ThirdGoodContextManager: # unexpected-special-method-signature
-# https://github.com/PyCQA/pylint/issues/6644
+# https://github.com/pylint-dev/pylint/issues/6644
class Philosopher:
def __init_subclass__(cls, default_name, **kwargs):
super().__init_subclass__(**kwargs)
diff --git a/tests/functional/u/ungrouped_imports.py b/tests/functional/u/ungrouped_imports.py index ace3a8e3f..b94fbeef9 100644 --- a/tests/functional/u/ungrouped_imports.py +++ b/tests/functional/u/ungrouped_imports.py @@ -26,7 +26,7 @@ from unittest import TestCase from unittest.mock import MagicMock -# https://github.com/PyCQA/pylint/issues/3382 +# https://github.com/pylint-dev/pylint/issues/3382 # Imports in a `if TYPE_CHECKING` block should not trigger `ungrouped-imports` from typing import TYPE_CHECKING if TYPE_CHECKING: diff --git a/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py index 74bf4e611..e02df87e3 100644 --- a/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py +++ b/tests/functional/u/unnecessary/unnecessary_dict_index_lookup.py @@ -73,7 +73,7 @@ for item in d.items(): # Test false positive described in #4630 -# (https://github.com/PyCQA/pylint/issues/4630) +# (https://github.com/pylint-dev/pylint/issues/4630) d = {'key': 'value'} @@ -90,7 +90,7 @@ for k, _ in d.items(): # Test false positive described in #4716 # Should not be emitted for del -# (https://github.com/PyCQA/pylint/issues/4716) +# (https://github.com/pylint-dev/pylint/issues/4716) d = {} for key, val in d.items(): del d[key] @@ -107,25 +107,25 @@ for key, val in outer_dict.items(): break # Test partial unpacking of items -# https://github.com/PyCQA/pylint/issues/5504 +# https://github.com/pylint-dev/pylint/issues/5504 d = {} for key, in d.items(): print(d[key]) # Test subscripting an attribute -# https://github.com/PyCQA/pylint/issues/6557 +# https://github.com/pylint-dev/pylint/issues/6557 f = Foo() for input_output in d.items(): f.input_output = input_output # pylint: disable=attribute-defined-outside-init print(d[f.input_output[0]]) -# Regression test for https://github.com/PyCQA/pylint/issues/6788 +# Regression test for https://github.com/pylint-dev/pylint/issues/6788 d = {'a': 1, 'b': 2, 'c': 3} for key, val in d.items(): ([d[key], x], y) = ([1, 2], 3) -# Regression test for https://github.com/PyCQA/pylint/issues/6818 +# Regression test for https://github.com/pylint-dev/pylint/issues/6818 d = {'a': 1, 'b': 2, 'c': 3} for key, val in d.items(): while d[key] > 0: diff --git a/tests/functional/u/unnecessary/unnecessary_ellipsis.py b/tests/functional/u/unnecessary/unnecessary_ellipsis.py index c46fd323a..081c4beda 100644 --- a/tests/functional/u/unnecessary/unnecessary_ellipsis.py +++ b/tests/functional/u/unnecessary/unnecessary_ellipsis.py @@ -123,7 +123,7 @@ def func1(val1, _): def func2(val1, val2): """Ignore if ellipsis is used on comparisons. - See https://github.com/PyCQA/pylint/issues/6071.""" + See https://github.com/pylint-dev/pylint/issues/6071.""" if val1 is not ... and val2: pass diff --git a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py index ec5ee22c2..9e99388d8 100644 --- a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py +++ b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py @@ -45,16 +45,16 @@ result = [val for idx, val in enumerate(my_list) if idx > 0 and my_list[idx - 1] result = [val for idx, val in enumerate(my_list) if other_list[idx] == 'a'] result = [my_list[idx] for idx, val in enumerate(my_list)] # [unnecessary-list-index-lookup] -# Regression test for https://github.com/PyCQA/pylint/issues/6049 +# Regression test for https://github.com/pylint-dev/pylint/issues/6049 pairs = [(0, 0)] for i, (a, b) in enumerate(pairs): print(pairs[i][0]) -# Regression test for https://github.com/PyCQA/pylint/issues/6603 +# Regression test for https://github.com/pylint-dev/pylint/issues/6603 for i, num in enumerate(): # raises TypeError, but shouldn't crash pylint pass -# Regression test for https://github.com/PyCQA/pylint/issues/6788 +# Regression test for https://github.com/pylint-dev/pylint/issues/6788 num_list = [1, 2, 3] for a, b in enumerate(num_list): num_list[a], _ = (2, 1) @@ -63,7 +63,7 @@ num_list = [1, 2, 3] for a, b in enumerate(num_list): ([x, num_list[a]], _) = ([5, 6], 1) -# Regression test for https://github.com/PyCQA/pylint/issues/6818 +# Regression test for https://github.com/pylint-dev/pylint/issues/6818 updated_list = [1, 2, 3] for idx, val in enumerate(updated_list): while updated_list[idx] > 0: @@ -75,14 +75,14 @@ for idx, val in enumerate(updated_list): updated_list[idx] -= 1 print(updated_list[idx]) -# Regression test for https://github.com/PyCQA/pylint/issues/6896 +# Regression test for https://github.com/pylint-dev/pylint/issues/6896 parts = ["a", "b", "c", "d"] for i, part in enumerate(parts): if i == 3: # more complex condition actually parts.insert(i, "X") print(part, parts[i]) -# regression tests for https://github.com/PyCQA/pylint/issues/7682 +# regression tests for https://github.com/pylint-dev/pylint/issues/7682 series = [1, 2, 3, 4, 5] output_list = [ (item, series[index]) diff --git a/tests/functional/u/unpacking/unpacking_non_sequence_py37.py b/tests/functional/u/unpacking/unpacking_non_sequence_py37.py index 13ab35b9a..3a1e3700a 100644 --- a/tests/functional/u/unpacking/unpacking_non_sequence_py37.py +++ b/tests/functional/u/unpacking/unpacking_non_sequence_py37.py @@ -1,11 +1,11 @@ """ -https://github.com/PyCQA/pylint/issues/4895 +https://github.com/pylint-dev/pylint/issues/4895 """ # pylint: disable=missing-docstring # Disabled because of a bug with pypy 3.8 see -# https://github.com/PyCQA/pylint/pull/7918#issuecomment-1352737369 +# https://github.com/pylint-dev/pylint/pull/7918#issuecomment-1352737369 # pylint: disable=multiple-statements from __future__ import annotations diff --git a/tests/functional/u/unreachable.py b/tests/functional/u/unreachable.py index 0211a6136..e59ad218f 100644 --- a/tests/functional/u/unreachable.py +++ b/tests/functional/u/unreachable.py @@ -25,7 +25,7 @@ def func4(): return 1 / 0 # [unreachable] -# https://github.com/PyCQA/pylint/issues/4698 +# https://github.com/pylint-dev/pylint/issues/4698 def func5(): """Empty generator functions should be allowed.""" return diff --git a/tests/functional/u/unspecified_encoding_py38.py b/tests/functional/u/unspecified_encoding_py38.py index 66b8523f4..6afdab92a 100644 --- a/tests/functional/u/unspecified_encoding_py38.py +++ b/tests/functional/u/unspecified_encoding_py38.py @@ -87,7 +87,7 @@ Path(FILENAME).open("w", encoding=LOCALE_ENCODING) # Tests for storing data about open calls. # Most of these are regression tests for a crash -# reported in https://github.com/PyCQA/pylint/issues/5321 +# reported in https://github.com/pylint-dev/pylint/issues/5321 # -- Constants MODE = "wb" @@ -126,7 +126,7 @@ open(FILENAME, mode=IOData.mode) open(FILENAME, mode=IOData().my_mode) open(FILENAME, mode=IOData().my_mode_method()) open(FILENAME, mode=IOData().my_mode_method_returner("wb")) -# Invalid value but shouldn't crash, reported in https://github.com/PyCQA/pylint/issues/5321 +# Invalid value but shouldn't crash, reported in https://github.com/pylint-dev/pylint/issues/5321 open(FILENAME, mode=IOData) @@ -141,7 +141,7 @@ class IOArgs: args_good_one = IOArgs(encoding=None, mode="wb") -# Test for crash reported in https://github.com/PyCQA/pylint/issues/5321 +# Test for crash reported in https://github.com/pylint-dev/pylint/issues/5321 open(FILENAME, args_good_one.mode, encoding=args_good_one.encoding) # Positional arguments @@ -157,8 +157,8 @@ Path(FILENAME).read_text() # [unspecified-encoding] Path(FILENAME).write_text("string", "utf-8") Path(FILENAME).write_text("string") # [unspecified-encoding] -# Test for crash reported in https://github.com/PyCQA/pylint/issues/5731 +# Test for crash reported in https://github.com/pylint-dev/pylint/issues/5731 open(FILENAME, mode=None) # [bad-open-mode, unspecified-encoding] -# Test for crash reported in https://github.com/PyCQA/pylint/issues/6414 +# Test for crash reported in https://github.com/pylint-dev/pylint/issues/6414 open('foo', mode=2) # [bad-open-mode, unspecified-encoding] diff --git a/tests/functional/u/unsubscriptable_object.py b/tests/functional/u/unsubscriptable_object.py index 0b7da78b3..4f21871d0 100644 --- a/tests/functional/u/unsubscriptable_object.py +++ b/tests/functional/u/unsubscriptable_object.py @@ -1,7 +1,7 @@ """Tests for unscubscriptable-object""" # Test for typing.NamedTuple -# See: https://github.com/PyCQA/pylint/issues/1295 +# See: https://github.com/pylint-dev/pylint/issues/1295 import typing MyType = typing.Tuple[str, str] diff --git a/tests/functional/u/unused/unused_argument.py b/tests/functional/u/unused/unused_argument.py index 69c37feef..1d072f21b 100644 --- a/tests/functional/u/unused/unused_argument.py +++ b/tests/functional/u/unused/unused_argument.py @@ -94,7 +94,7 @@ class BBBB: self.spam = 1 -# Regression test for https://github.com/PyCQA/pylint/issues/5771 +# Regression test for https://github.com/pylint-dev/pylint/issues/5771 # involving keyword-only arguments class Ancestor: def __init__(self): diff --git a/tests/functional/u/unused/unused_import.py b/tests/functional/u/unused/unused_import.py index 0abc7bf4d..c3d596b24 100644 --- a/tests/functional/u/unused/unused_import.py +++ b/tests/functional/u/unused/unused_import.py @@ -105,7 +105,7 @@ class WithMetaclass(six.with_metaclass(ABCMeta)): Requires six.""" -# Regression test for https://github.com/PyCQA/pylint/issues/3765 +# Regression test for https://github.com/pylint-dev/pylint/issues/3765 # `unused-import` should not be emitted when a type annotation uses quotation marks from typing import List diff --git a/tests/functional/u/unused/unused_import_class_def_keyword.py b/tests/functional/u/unused/unused_import_class_def_keyword.py index 0d6b59987..161d33cdb 100644 --- a/tests/functional/u/unused/unused_import_class_def_keyword.py +++ b/tests/functional/u/unused/unused_import_class_def_keyword.py @@ -1,7 +1,7 @@ """ Test false-positive for unused-import on class keyword arguments - https://github.com/PyCQA/pylint/issues/3202 + https://github.com/pylint-dev/pylint/issues/3202 """ # pylint: disable=missing-docstring,too-few-public-methods,invalid-name,import-error diff --git a/tests/functional/u/unused/unused_import_everything_disabled.py b/tests/functional/u/unused/unused_import_everything_disabled.py index 381cd012f..3c7d6c9ec 100644 --- a/tests/functional/u/unused/unused_import_everything_disabled.py +++ b/tests/functional/u/unused/unused_import_everything_disabled.py @@ -1,7 +1,7 @@ """Test that unused-import is not emitted here when everything else is disabled -https://github.com/PyCQA/pylint/issues/3445 -https://github.com/PyCQA/pylint/issues/6089 +https://github.com/pylint-dev/pylint/issues/3445 +https://github.com/pylint-dev/pylint/issues/6089 """ from math import e, pi from os import environ diff --git a/tests/functional/u/unused/unused_import_positional_only_py38.py b/tests/functional/u/unused/unused_import_positional_only_py38.py index 693a377d9..ceaad539d 100644 --- a/tests/functional/u/unused/unused_import_positional_only_py38.py +++ b/tests/functional/u/unused/unused_import_positional_only_py38.py @@ -1,6 +1,6 @@ """Test that positional only argument annotations are properly marked as consumed -https://github.com/PyCQA/pylint/issues/3462 +https://github.com/pylint-dev/pylint/issues/3462 """ from typing import AnyStr, Set diff --git a/tests/functional/u/unused/unused_private_member.py b/tests/functional/u/unused/unused_private_member.py index 1696fb691..6b14b001f 100644 --- a/tests/functional/u/unused/unused_private_member.py +++ b/tests/functional/u/unused/unused_private_member.py @@ -106,7 +106,7 @@ k = Klass() print(k.twentyone) print(k.ninetyfive) -# https://github.com/PyCQA/pylint/issues/4657 +# https://github.com/pylint-dev/pylint/issues/4657 # Mutation of class member with cls should not fire a false-positive class FalsePositive4657: """False positive tests for 4657""" @@ -140,7 +140,7 @@ class FalsePositive4657: return cls.__attr_c # [undefined-variable] -# https://github.com/PyCQA/pylint/issues/4668 +# https://github.com/pylint-dev/pylint/issues/4668 # Attributes assigned within __new__() has to be processed as part of the class class FalsePositive4668: # pylint: disable=protected-access, no-member, unreachable @@ -166,7 +166,7 @@ class FalsePositive4668: return self.func(*self.__args) -# https://github.com/PyCQA/pylint/issues/4673 +# https://github.com/pylint-dev/pylint/issues/4673 # Nested functions shouldn't cause a false positive if they are properly used class FalsePositive4673: """ The testing class """ @@ -207,7 +207,7 @@ class FalsePositive4673: return fn_to_return -# https://github.com/PyCQA/pylint/issues/4755 +# https://github.com/pylint-dev/pylint/issues/4755 # Nested attributes shouldn't cause crash class Crash4755Context: def __init__(self): @@ -223,7 +223,7 @@ class Crash4755Command: print(message) -# https://github.com/PyCQA/pylint/issues/4681 +# https://github.com/pylint-dev/pylint/issues/4681 # Accessing attributes of the class using the class name should not result in a false positive # as long as it is used within the class class FalsePositive4681: @@ -263,7 +263,7 @@ class FalsePositive4681b: FalsePositive4681b.__instance = False # This should be fine -# https://github.com/PyCQA/pylint/issues/4849 +# https://github.com/pylint-dev/pylint/issues/4849 # Accessing private static methods from classmethods via `cls` should not result in a # false positive class FalsePositive4849: @@ -283,7 +283,7 @@ class FalsePositive4849: class Pony: - """https://github.com/PyCQA/pylint/issues/4837""" + """https://github.com/pylint-dev/pylint/issues/4837""" __defaults = {} __defaults_set = False @@ -305,7 +305,7 @@ def lookup_attribute(mapping, key): # Test for regression on checking __class__ attribute -# See: https://github.com/PyCQA/pylint/issues/5261 +# See: https://github.com/pylint-dev/pylint/issues/5261 class Foo: __ham = 1 @@ -313,7 +313,7 @@ class Foo: print(self.__class__.__ham) -# https://github.com/PyCQA/pylint/issues/4756 +# https://github.com/pylint-dev/pylint/issues/4756 # Check for false positives emitted when private functions are not referenced in the class body # with standard calls but passed as arguments to other functions. class FalsePositive4756a: @@ -347,7 +347,7 @@ class TypeSelfCallInMethod: class Item: - """Regression test for https://github.com/PyCQA/pylint/issues/6709""" + """Regression test for https://github.com/pylint-dev/pylint/issues/6709""" def __init__(self, parent): self.__parent: Item = parent self.__item = self.__parent.__item # [unused-private-member] diff --git a/tests/functional/u/unused/unused_typing_imports.py b/tests/functional/u/unused/unused_typing_imports.py index 7de4e411b..3b9b7aa06 100644 --- a/tests/functional/u/unused/unused_typing_imports.py +++ b/tests/functional/u/unused/unused_typing_imports.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring -"""Regression test for https://github.com/PyCQA/pylint/issues/1168 +"""Regression test for https://github.com/pylint-dev/pylint/issues/1168 The problem was that we weren't handling keyword-only arguments annotations, which means we were never processing them. diff --git a/tests/functional/u/unused/unused_variable.py b/tests/functional/u/unused/unused_variable.py index 0058516c9..9dabe5b59 100644 --- a/tests/functional/u/unused/unused_variable.py +++ b/tests/functional/u/unused/unused_variable.py @@ -155,7 +155,7 @@ def func4(): def main(lst): - """https://github.com/PyCQA/astroid/pull/1111#issuecomment-890367609""" + """https://github.com/pylint-dev/astroid/pull/1111#issuecomment-890367609""" try: raise ValueError except ValueError as e: # [unused-variable] diff --git a/tests/functional/u/unused/unused_variable_after_inference.py b/tests/functional/u/unused/unused_variable_after_inference.py index 569564dc9..5020cd32f 100644 --- a/tests/functional/u/unused/unused_variable_after_inference.py +++ b/tests/functional/u/unused/unused_variable_after_inference.py @@ -1,4 +1,4 @@ -"""Regression test for https://github.com/PyCQA/pylint/issues/6895""" +"""Regression test for https://github.com/pylint-dev/pylint/issues/6895""" # pylint: disable=missing-class-docstring,too-few-public-methods import argparse class Cls: diff --git a/tests/functional/u/use/use_a_generator.py b/tests/functional/u/use/use_a_generator.py index 279deb46f..6327eb1a2 100644 --- a/tests/functional/u/use/use_a_generator.py +++ b/tests/functional/u/use/use_a_generator.py @@ -1,5 +1,5 @@ # pylint: disable=missing-docstring, invalid-name -# https://github.com/PyCQA/pylint/issues/3165 +# https://github.com/pylint-dev/pylint/issues/3165 any([]) all([]) diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison.py index 681ee0607..26b6aeaef 100644 --- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.py +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.py @@ -1,11 +1,11 @@ # pylint: disable=missing-docstring, missing-module-docstring, invalid-name # pylint: disable=too-few-public-methods, line-too-long, dangerous-default-value # pylint: disable=wrong-import-order -# https://github.com/PyCQA/pylint/issues/4774 +# https://github.com/pylint-dev/pylint/issues/4774 def github_issue_4774(): # Test literals - # https://github.com/PyCQA/pylint/issues/4774 + # https://github.com/pylint-dev/pylint/issues/4774 good_list = [] if not good_list: pass @@ -197,7 +197,7 @@ if long_test == { }: # [use-implicit-booleaness-not-comparison] # Check for properties and uninferable class methods -# See https://github.com/PyCQA/pylint/issues/5646 +# See https://github.com/pylint-dev/pylint/issues/5646 from xyz import AnotherClassWithProperty diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt index 2ace15d7e..f4cf77747 100644 --- a/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison.txt @@ -1,32 +1,32 @@ -use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:'bad_list == []' can be simplified to 'not bad_list' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:22:3:22:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:25:3:25:19::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:28:3:28:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:31:3:31:20::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:34:3:34:19::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:37:3:37:19::'empty_dict == {}' can be simplified to 'not empty_dict' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:'t == ()' can be simplified to 'not t' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:'b == []' can be simplified to 'not b' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:'c == {}' can be simplified to 'not c' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:52:7:52:24::'empty_tuple == ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:53:7:53:23::'empty_list == []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:54:7:54:23::'empty_dict != {}' can be simplified to 'empty_dict' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:55:7:55:23::'empty_tuple < ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:56:7:56:23::'empty_list <= []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:57:7:57:23::'empty_tuple > ()' can be simplified to 'not empty_tuple' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:58:7:58:23::'empty_list >= []' can be simplified to 'not empty_list' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:83:3:83:10::'a == []' can be simplified to 'not a' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:95:3:95:10::'e == []' can be simplified to 'not e' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:95:15:95:22::'f == {}' can be simplified to 'not f' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:133:3:133:14::'A.lst == []' can be simplified to 'not A.lst' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:137:3:137:14::'A.lst == []' can be simplified to 'not A.lst' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:141:3:141:20::'A.test(...) == []' can be simplified to 'not A.test(...)' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:149:3:149:24::'test_function(...) == []' can be simplified to 'not test_function(...)' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:156:3:156:20::'numpy_array == []' can be simplified to 'not numpy_array' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:158:3:158:20::'numpy_array != []' can be simplified to 'numpy_array' as an empty list is falsey:HIGH -use-implicit-booleaness-not-comparison:160:3:160:20::'numpy_array >= ()' can be simplified to 'not numpy_array' as an empty tuple is falsey:HIGH -use-implicit-booleaness-not-comparison:185:3:185:13::'data == {}' can be simplified to 'not data' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:187:3:187:13::'data != {}' can be simplified to 'data' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:195:3:195:26::'long_test == {}' can be simplified to 'not long_test' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:233:11:233:41:test_func:'my_class.parent_function == {}' can be simplified to 'not my_class.parent_function' as an empty dict is falsey:HIGH -use-implicit-booleaness-not-comparison:234:11:234:37:test_func:'my_class.my_property == {}' can be simplified to 'not my_class.my_property' as an empty dict is falsey:HIGH +use-implicit-booleaness-not-comparison:14:7:14:21:github_issue_4774:"""bad_list == []"" can be simplified to ""not bad_list"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:22:3:22:20::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:25:3:25:19::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:28:3:28:19::"""empty_dict == {}"" can be simplified to ""not empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:31:3:31:20::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:34:3:34:19::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:37:3:37:19::"""empty_dict == {}"" can be simplified to ""not empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:42:11:42:18:bad_tuple_return:"""t == ()"" can be simplified to ""not t"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:46:11:46:18:bad_list_return:"""b == []"" can be simplified to ""not b"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:50:11:50:18:bad_dict_return:"""c == {}"" can be simplified to ""not c"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:52:7:52:24::"""empty_tuple == ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:53:7:53:23::"""empty_list == []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:54:7:54:23::"""empty_dict != {}"" can be simplified to ""empty_dict"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:55:7:55:23::"""empty_tuple < ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:56:7:56:23::"""empty_list <= []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:57:7:57:23::"""empty_tuple > ()"" can be simplified to ""not empty_tuple"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:58:7:58:23::"""empty_list >= []"" can be simplified to ""not empty_list"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:83:3:83:10::"""a == []"" can be simplified to ""not a"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:95:3:95:10::"""e == []"" can be simplified to ""not e"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:95:15:95:22::"""f == {}"" can be simplified to ""not f"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:133:3:133:14::"""A.lst == []"" can be simplified to ""not A.lst"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:137:3:137:14::"""A.lst == []"" can be simplified to ""not A.lst"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:141:3:141:20::"""A.test(...) == []"" can be simplified to ""not A.test(...)"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:149:3:149:24::"""test_function(...) == []"" can be simplified to ""not test_function(...)"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:156:3:156:20::"""numpy_array == []"" can be simplified to ""not numpy_array"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:158:3:158:20::"""numpy_array != []"" can be simplified to ""numpy_array"", if it is strictly a sequence, as an empty list is falsey":HIGH +use-implicit-booleaness-not-comparison:160:3:160:20::"""numpy_array >= ()"" can be simplified to ""not numpy_array"", if it is strictly a sequence, as an empty tuple is falsey":HIGH +use-implicit-booleaness-not-comparison:185:3:185:13::"""data == {}"" can be simplified to ""not data"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:187:3:187:13::"""data != {}"" can be simplified to ""data"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:195:3:195:26::"""long_test == {}"" can be simplified to ""not long_test"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:233:11:233:41:test_func:"""my_class.parent_function == {}"" can be simplified to ""not my_class.parent_function"", if it is strictly a sequence, as an empty dict is falsey":HIGH +use-implicit-booleaness-not-comparison:234:11:234:37:test_func:"""my_class.my_property == {}"" can be simplified to ""not my_class.my_property"", if it is strictly a sequence, as an empty dict is falsey":HIGH diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py new file mode 100644 index 000000000..4fbf0fc1d --- /dev/null +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.py @@ -0,0 +1,22 @@ +# pylint: disable=literal-comparison,missing-docstring + +X = '' +Y = 'test' + +if X is '': # [use-implicit-booleaness-not-comparison-to-string] + pass + +if Y is not "": # [use-implicit-booleaness-not-comparison-to-string] + pass + +if X == "": # [use-implicit-booleaness-not-comparison-to-string] + pass + +if Y != '': # [use-implicit-booleaness-not-comparison-to-string] + pass + +if "" == Y: # [use-implicit-booleaness-not-comparison-to-string] + pass + +if '' != X: # [use-implicit-booleaness-not-comparison-to-string] + pass diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc new file mode 100644 index 000000000..14648884d --- /dev/null +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.rc @@ -0,0 +1,2 @@ +[MAIN] +enable=use-implicit-booleaness-not-comparison-to-string diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt new file mode 100644 index 000000000..5f07a683c --- /dev/null +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_string.txt @@ -0,0 +1,6 @@ +use-implicit-booleaness-not-comparison-to-string:6:3:6:10::"""X is ''"" can be simplified to ""not X"", if it is striclty a string, as an empty string is falsey":HIGH +use-implicit-booleaness-not-comparison-to-string:9:3:9:14::"""Y is not ''"" can be simplified to ""Y"", if it is striclty a string, as an empty string is falsey":HIGH +use-implicit-booleaness-not-comparison-to-string:12:3:12:10::"""X == ''"" can be simplified to ""not X"", if it is striclty a string, as an empty string is falsey":HIGH +use-implicit-booleaness-not-comparison-to-string:15:3:15:10::"""Y != ''"" can be simplified to ""Y"", if it is striclty a string, as an empty string is falsey":HIGH +use-implicit-booleaness-not-comparison-to-string:18:3:18:10::"""'' == Y"" can be simplified to ""not Y"", if it is striclty a string, as an empty string is falsey":HIGH +use-implicit-booleaness-not-comparison-to-string:21:3:21:10::"""'' != X"" can be simplified to ""X"", if it is striclty a string, as an empty string is falsey":HIGH diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py new file mode 100644 index 000000000..766b1f547 --- /dev/null +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.py @@ -0,0 +1,46 @@ +# pylint: disable=literal-comparison,missing-docstring, singleton-comparison + +X = 123 +Y = len('test') + +if X is 0: # [use-implicit-booleaness-not-comparison-to-zero] + pass + +if X is False: + pass + +if Y is not 0: # [use-implicit-booleaness-not-comparison-to-zero] + pass + +if Y is not False: + pass + +if X == 0: # [use-implicit-booleaness-not-comparison-to-zero] + pass + +if X == False: + pass + +if 0 == Y: # [use-implicit-booleaness-not-comparison-to-zero] + pass + +if Y != 0: # [use-implicit-booleaness-not-comparison-to-zero] + pass + +if 0 != X: # [use-implicit-booleaness-not-comparison-to-zero] + pass + +if Y != False: + pass + +if X > 0: + pass + +if X < 0: + pass + +if 0 < X: + pass + +if 0 > X: + pass diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc new file mode 100644 index 000000000..be01705b1 --- /dev/null +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.rc @@ -0,0 +1,2 @@ +[MAIN] +enable=compare-to-zero, diff --git a/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt new file mode 100644 index 000000000..cb7d57699 --- /dev/null +++ b/tests/functional/u/use/use_implicit_booleaness_not_comparison_to_zero.txt @@ -0,0 +1,6 @@ +use-implicit-booleaness-not-comparison-to-zero:6:3:6:9::"""X is 0"" can be simplified to ""not X"", if it is strictly an int, as 0 is falsey":HIGH +use-implicit-booleaness-not-comparison-to-zero:12:3:12:13::"""Y is not 0"" can be simplified to ""Y"", if it is strictly an int, as 0 is falsey":HIGH +use-implicit-booleaness-not-comparison-to-zero:18:3:18:9::"""X == 0"" can be simplified to ""not X"", if it is strictly an int, as 0 is falsey":HIGH +use-implicit-booleaness-not-comparison-to-zero:24:3:24:9::"""0 == Y"" can be simplified to ""not Y"", if it is strictly an int, as 0 is falsey":HIGH +use-implicit-booleaness-not-comparison-to-zero:27:3:27:9::"""Y != 0"" can be simplified to ""Y"", if it is strictly an int, as 0 is falsey":HIGH +use-implicit-booleaness-not-comparison-to-zero:30:3:30:9::"""0 != X"" can be simplified to ""X"", if it is strictly an int, as 0 is falsey":HIGH diff --git a/tests/functional/u/use/use_implicit_booleaness_not_len.py b/tests/functional/u/use/use_implicit_booleaness_not_len.py index 4002a6dda..79547d99e 100644 --- a/tests/functional/u/use/use_implicit_booleaness_not_len.py +++ b/tests/functional/u/use/use_implicit_booleaness_not_len.py @@ -158,28 +158,28 @@ def github_issue_1879(): return 1 return 2 - # def function_returning_generator(r): - # for i in [r, 1, 2, 3]: - # yield i + def function_returning_generator(r): + for i in [r, 1, 2, 3]: + yield i - # def function_returning_comprehension(r): - # return [x+1 for x in [r, 1, 2, 3]] + def function_returning_comprehension(r): + return [x+1 for x in [r, 1, 2, 3]] - # def function_returning_function(r): - # return function_returning_generator(r) + def function_returning_function(r): + return function_returning_generator(r) assert len(function_returning_list(z)) # [use-implicit-booleaness-not-len] assert len(function_returning_int(z)) # This should raise a use-implicit-booleaness-not-len once astroid can infer it - # See https://github.com/PyCQA/pylint/pull/3821#issuecomment-743771514 - # assert len(function_returning_generator(z)) - # assert len(function_returning_comprehension(z)) - # assert len(function_returning_function(z)) + # See https://github.com/pylint-dev/pylint/pull/3821#issuecomment-743771514 + assert len(function_returning_generator(z)) + assert len(function_returning_comprehension(z)) + assert len(function_returning_function(z)) def github_issue_4215(): # Test undefined variables - # https://github.com/PyCQA/pylint/issues/4215 + # https://github.com/pylint-dev/pylint/issues/4215 if len(undefined_var): # [undefined-variable] pass if len(undefined_var2[0]): # [undefined-variable] diff --git a/tests/functional/u/use/use_maxsplit_arg.py b/tests/functional/u/use/use_maxsplit_arg.py index 449457a0c..11e51c116 100644 --- a/tests/functional/u/use/use_maxsplit_arg.py +++ b/tests/functional/u/use/use_maxsplit_arg.py @@ -84,7 +84,7 @@ a = "1,2,3".split('split')[-1] # [use-maxsplit-arg] a = "1,2,3".rsplit('rsplit')[0] # [use-maxsplit-arg]
# Test cases for false-positive reported in #4664
-# https://github.com/PyCQA/pylint/issues/4664
+# https://github.com/pylint-dev/pylint/issues/4664
source = 'A.B.C.D.E.F.G'
i = 0
for j in range(5):
@@ -92,7 +92,7 @@ for j in range(5): i = i + 1
# Test for crash when sep is given by keyword
-# https://github.com/PyCQA/pylint/issues/5737
+# https://github.com/pylint-dev/pylint/issues/5737
get_last = SEQ.split(sep=None)[-1] # [use-maxsplit-arg]
diff --git a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py index a43a89aa1..e0d874ff8 100644 --- a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py +++ b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.py @@ -1,6 +1,6 @@ """Tests for used-before-assignment with assignments in except handlers after try blocks with return statements. -See: https://github.com/PyCQA/pylint/issues/5500. +See: https://github.com/pylint-dev/pylint/issues/5500. """ # pylint: disable=inconsistent-return-statements diff --git a/tests/functional/u/used/used_before_assignment.py b/tests/functional/u/used/used_before_assignment.py index d36b2fd8d..9b7d668ca 100644 --- a/tests/functional/u/used/used_before_assignment.py +++ b/tests/functional/u/used/used_before_assignment.py @@ -1,6 +1,6 @@ """Miscellaneous used-before-assignment cases""" # pylint: disable=consider-using-f-string, missing-function-docstring - +import datetime MSG = "hello %s" % MSG # [used-before-assignment] @@ -14,6 +14,17 @@ def outer(): outer() +class ClassWithProperty: # pylint: disable=too-few-public-methods + """This test depends on earlier and later defined module-level functions.""" + prop = property(redefine_time_import) # [used-before-assignment] + prop_defined_earlier = property(outer) + + +calculate(1.01, 2) # [used-before-assignment] +def calculate(value1: int, value2: float) -> int: + return value1 + value2 + + # pylint: disable=unused-import, wrong-import-position, import-outside-toplevel, reimported, redefined-outer-name, global-statement import time def redefine_time_import(): @@ -108,7 +119,7 @@ for num in [0, 1]: print(VAR12) def turn_on2(**kwargs): - """https://github.com/PyCQA/pylint/issues/7873""" + """https://github.com/pylint-dev/pylint/issues/7873""" if "brightness" in kwargs: brightness = kwargs["brightness"] var, *args = (1, "set_dimmer_state", brightness) @@ -116,3 +127,50 @@ def turn_on2(**kwargs): var, *args = (1, "restore_dimmer_state") print(var, *args) + + +# Variables guarded by the same test when used. + +# Always false +if __name__ == "__main__": + PERCENT = 20 + SALE = True + +if __name__ == "__main__": + print(PERCENT) + +# Different test +if __name__ is None: + print(SALE) # [used-before-assignment] + + +# Ambiguous, but same test +if not datetime.date.today(): + WAS_TODAY = True + +if not datetime.date.today(): + print(WAS_TODAY) + + +# Different tests but same inferred values +# Need falsy values here +def give_me_zero(): + return 0 + +def give_me_nothing(): + return 0 + +if give_me_zero(): + WE_HAVE_ZERO = True + ALL_DONE = True + +if give_me_nothing(): + print(WE_HAVE_ZERO) + + +# Different tests, different values +def give_me_none(): + return None + +if give_me_none(): + print(ALL_DONE) # [used-before-assignment] diff --git a/tests/functional/u/used/used_before_assignment.txt b/tests/functional/u/used/used_before_assignment.txt index 70153f39a..37b25ab49 100644 --- a/tests/functional/u/used/used_before_assignment.txt +++ b/tests/functional/u/used/used_before_assignment.txt @@ -1,8 +1,12 @@ used-before-assignment:5:19:5:22::Using variable 'MSG' before assignment:HIGH used-before-assignment:7:20:7:24::Using variable 'MSG2' before assignment:HIGH used-before-assignment:10:4:10:9:outer:Using variable 'inner' before assignment:HIGH -used-before-assignment:20:10:20:14:redefine_time_import:Using variable 'time' before assignment:HIGH -used-before-assignment:34:3:34:7::Using variable 'VAR2' before assignment:CONTROL_FLOW -used-before-assignment:52:3:52:7::Using variable 'VAR4' before assignment:CONTROL_FLOW -used-before-assignment:67:3:67:7::Using variable 'VAR6' before assignment:CONTROL_FLOW -used-before-assignment:102:6:102:11::Using variable 'VAR10' before assignment:CONTROL_FLOW +used-before-assignment:19:20:19:40:ClassWithProperty:Using variable 'redefine_time_import' before assignment:HIGH +used-before-assignment:23:0:23:9::Using variable 'calculate' before assignment:HIGH +used-before-assignment:31:10:31:14:redefine_time_import:Using variable 'time' before assignment:HIGH +used-before-assignment:45:3:45:7::Using variable 'VAR2' before assignment:CONTROL_FLOW +used-before-assignment:63:3:63:7::Using variable 'VAR4' before assignment:CONTROL_FLOW +used-before-assignment:78:3:78:7::Using variable 'VAR6' before assignment:CONTROL_FLOW +used-before-assignment:113:6:113:11::Using variable 'VAR10' before assignment:CONTROL_FLOW +used-before-assignment:144:10:144:14::Using variable 'SALE' before assignment:CONTROL_FLOW +used-before-assignment:176:10:176:18::Using variable 'ALL_DONE' before assignment:CONTROL_FLOW diff --git a/tests/functional/u/used/used_before_assignment_class_nested_under_function.py b/tests/functional/u/used/used_before_assignment_class_nested_under_function.py index 3627ae1e1..43734757b 100644 --- a/tests/functional/u/used/used_before_assignment_class_nested_under_function.py +++ b/tests/functional/u/used/used_before_assignment_class_nested_under_function.py @@ -1,4 +1,4 @@ -"""https://github.com/PyCQA/pylint/issues/4590""" +"""https://github.com/pylint-dev/pylint/issues/4590""" # pylint: disable=too-few-public-methods diff --git a/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py b/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py index 2321afed7..6c7fe411a 100644 --- a/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py +++ b/tests/functional/u/used/used_before_assignment_comprehension_homonyms.py @@ -2,7 +2,7 @@ # pylint: disable=broad-exception-raised def func(): - """https://github.com/PyCQA/pylint/issues/5586""" + """https://github.com/pylint-dev/pylint/issues/5586""" try: print(value for value in range(1 / 0) if isinstance(value, int)) except ZeroDivisionError: @@ -29,7 +29,7 @@ def func3(): def func4(): - """https://github.com/PyCQA/pylint/issues/6035""" + """https://github.com/pylint-dev/pylint/issues/6035""" assets = [asset for asset in range(3) if asset.name == "filename"] try: @@ -54,7 +54,7 @@ def func5(): def func6(data, keys): """Similar, but with a subscript in a key-value pair rather than the test - See https://github.com/PyCQA/pylint/issues/6069""" + See https://github.com/pylint-dev/pylint/issues/6069""" try: results = {key: data[key] for key in keys} except KeyError as exc: diff --git a/tests/functional/u/used/used_before_assignment_else_return.py b/tests/functional/u/used/used_before_assignment_else_return.py index a7e58bb61..8dcd21337 100644 --- a/tests/functional/u/used/used_before_assignment_else_return.py +++ b/tests/functional/u/used/used_before_assignment_else_return.py @@ -3,7 +3,7 @@ import sys def valid(): - """https://github.com/PyCQA/pylint/issues/6790""" + """https://github.com/pylint-dev/pylint/issues/6790""" try: pass except ValueError: diff --git a/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py b/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py index c83a48473..418fee298 100644 --- a/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py +++ b/tests/functional/u/used/used_before_assignment_except_handler_for_try_with_return.py @@ -1,6 +1,6 @@ """Tests for used-before-assignment with assignments in except handlers after try blocks with return statements. -See: https://github.com/PyCQA/pylint/issues/5500. +See: https://github.com/pylint-dev/pylint/issues/5500. """ # pylint: disable=inconsistent-return-statements,broad-exception-raised diff --git a/tests/functional/u/used/used_before_assignment_issue2615.py b/tests/functional/u/used/used_before_assignment_issue2615.py index bce073bf3..e2e5a4181 100644 --- a/tests/functional/u/used/used_before_assignment_issue2615.py +++ b/tests/functional/u/used/used_before_assignment_issue2615.py @@ -1,4 +1,4 @@ -"""https://github.com/PyCQA/pylint/issues/2615""" +"""https://github.com/pylint-dev/pylint/issues/2615""" def main(): """When evaluating except blocks, assume try statements fail.""" try: diff --git a/tests/functional/u/used/used_before_assignment_issue4761.py b/tests/functional/u/used/used_before_assignment_issue4761.py index 6f8e048e4..7ba77be62 100644 --- a/tests/functional/u/used/used_before_assignment_issue4761.py +++ b/tests/functional/u/used/used_before_assignment_issue4761.py @@ -13,7 +13,7 @@ def function(): def uses_nonlocal(): - """https://github.com/PyCQA/pylint/issues/5965""" + """https://github.com/pylint-dev/pylint/issues/5965""" count = 0 def inner(): nonlocal count @@ -46,7 +46,7 @@ def uses_unrelated_nonlocal(): # only non-break exit branch. def valid_only_non_break_exit_from_loop_is_except_handler(): - """https://github.com/PyCQA/pylint/issues/5683""" + """https://github.com/pylint-dev/pylint/issues/5683""" for _ in range(3): try: function() # not an exit branch because of `else` below diff --git a/tests/functional/u/used/used_before_assignment_issue85.py b/tests/functional/u/used/used_before_assignment_issue85.py index 367af9dfa..7ede436bb 100644 --- a/tests/functional/u/used/used_before_assignment_issue85.py +++ b/tests/functional/u/used/used_before_assignment_issue85.py @@ -1,4 +1,4 @@ -"""https://github.com/PyCQA/pylint/issues/85""" +"""https://github.com/pylint-dev/pylint/issues/85""" def main(): """When evaluating finally blocks, assume try statements fail.""" try: @@ -54,7 +54,7 @@ def try_except_finally_nested_try_finally_in_try(): def try_except_finally_nested_in_finally(): """Until Pylint comes to a consensus on requiring all except handlers to - define a name, raise, or return (https://github.com/PyCQA/pylint/issues/5524), + define a name, raise, or return (https://github.com/pylint-dev/pylint/issues/5524), Pylint assumes statements in try blocks succeed when accessed *after* except or finally blocks and fail when accessed *in* except or finally blocks.) diff --git a/tests/functional/u/used/used_before_assignment_nonlocal.py b/tests/functional/u/used/used_before_assignment_nonlocal.py index 18e16177d..4d926e9eb 100644 --- a/tests/functional/u/used/used_before_assignment_nonlocal.py +++ b/tests/functional/u/used/used_before_assignment_nonlocal.py @@ -60,7 +60,7 @@ nonlocal_in_ifexp() def type_annotation_only_gets_value_via_nonlocal():
- """https://github.com/PyCQA/pylint/issues/5394"""
+ """https://github.com/pylint-dev/pylint/issues/5394"""
some_num: int
def inner():
nonlocal some_num
diff --git a/tests/functional/u/used/used_before_assignment_postponed_evaluation.py b/tests/functional/u/used/used_before_assignment_postponed_evaluation.py new file mode 100644 index 000000000..4ff22470c --- /dev/null +++ b/tests/functional/u/used/used_before_assignment_postponed_evaluation.py @@ -0,0 +1,13 @@ +"""Tests for used-before-assignment when postponed evaluation of annotations is enabled""" +# pylint: disable=missing-function-docstring, invalid-name +from __future__ import annotations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + var = 1 + import math + +print(var) # [used-before-assignment] + +def function_one(m: math): # no error for annotations + return m diff --git a/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt b/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt new file mode 100644 index 000000000..88a958736 --- /dev/null +++ b/tests/functional/u/used/used_before_assignment_postponed_evaluation.txt @@ -0,0 +1 @@ +used-before-assignment:10:6:10:9::Using variable 'var' before assignment:CONTROL_FLOW diff --git a/tests/functional/u/used/used_before_assignment_py37.py b/tests/functional/u/used/used_before_assignment_py37.py index c64bf7cf5..1b0a895bf 100644 --- a/tests/functional/u/used/used_before_assignment_py37.py +++ b/tests/functional/u/used/used_before_assignment_py37.py @@ -30,6 +30,6 @@ class MyClass: class NamedTupleSubclass(namedtuple("NamedTupleSubclass", [])): - """Taken from https://github.com/PyCQA/pylint/issues/5982""" + """Taken from https://github.com/pylint-dev/pylint/issues/5982""" def method(self) -> NamedTupleSubclass: """Variables checker crashed when astroid did not supply a lineno""" diff --git a/tests/functional/u/used/used_before_assignment_scoping.py b/tests/functional/u/used/used_before_assignment_scoping.py new file mode 100644 index 000000000..0d88210bd --- /dev/null +++ b/tests/functional/u/used/used_before_assignment_scoping.py @@ -0,0 +1,18 @@ +# pylint: disable=missing-function-docstring, missing-module-docstring + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from datetime import datetime + + +def func_two(): + second = datetime.now() # [used-before-assignment] + return second + + +def func(): + first: datetime + first = datetime.now() # [used-before-assignment] + second = datetime.now() + return first, second diff --git a/tests/functional/u/used/used_before_assignment_scoping.txt b/tests/functional/u/used/used_before_assignment_scoping.txt new file mode 100644 index 000000000..32b6d3e1b --- /dev/null +++ b/tests/functional/u/used/used_before_assignment_scoping.txt @@ -0,0 +1,2 @@ +used-before-assignment:10:13:10:21:func_two:Using variable 'datetime' before assignment:CONTROL_FLOW +used-before-assignment:16:12:16:20:func:Using variable 'datetime' before assignment:CONTROL_FLOW diff --git a/tests/functional/u/used/used_before_assignment_ternary.txt b/tests/functional/u/used/used_before_assignment_ternary.txt index d991970e4..bcb21df1c 100644 --- a/tests/functional/u/used/used_before_assignment_ternary.txt +++ b/tests/functional/u/used/used_before_assignment_ternary.txt @@ -1,3 +1,3 @@ -used-before-assignment:6:14:6:15:invalid:Using variable 'a' before assignment:HIGH
-used-before-assignment:8:14:8:15:invalid:Using variable 'b' before assignment:HIGH
-used-before-assignment:9:10:9:11:invalid:Using variable 'c' before assignment:HIGH
+used-before-assignment:6:14:6:15:invalid:Using variable 'a' before assignment:HIGH +used-before-assignment:8:14:8:15:invalid:Using variable 'b' before assignment:HIGH +used-before-assignment:9:10:9:11:invalid:Using variable 'c' before assignment:HIGH diff --git a/tests/functional/u/used/used_before_assignment_type_annotations.py b/tests/functional/u/used/used_before_assignment_type_annotations.py index 1a03050c3..e70a911ca 100644 --- a/tests/functional/u/used/used_before_assignment_type_annotations.py +++ b/tests/functional/u/used/used_before_assignment_type_annotations.py @@ -77,7 +77,7 @@ def typing_and_value_assignment_with_tuple_assignment(): def nested_class_as_return_annotation(): """A namedtuple as a class attribute is used as a return annotation - Taken from https://github.com/PyCQA/pylint/issues/5568""" + Taken from https://github.com/pylint-dev/pylint/issues/5568""" class MyObject: """namedtuple as class attribute""" Coords = namedtuple('Point', ['x', 'y']) diff --git a/tests/functional/u/used/used_before_assignment_typing.py b/tests/functional/u/used/used_before_assignment_typing.py index a685bdabc..9ec040ff6 100644 --- a/tests/functional/u/used/used_before_assignment_typing.py +++ b/tests/functional/u/used/used_before_assignment_typing.py @@ -7,11 +7,12 @@ from typing import List, Optional, TYPE_CHECKING if TYPE_CHECKING: if True: # pylint: disable=using-constant-test import math + import dbm + print(dbm) # no error when defined and used in the same false branch from urllib.request import urlopen import array import base64 import binascii - import bisect import calendar import collections import copy @@ -91,7 +92,7 @@ class MyClass: class MySecondClass: """Class to test self referential variable typing. - This regressed, reported in: https://github.com/PyCQA/pylint/issues/5342 + This regressed, reported in: https://github.com/pylint-dev/pylint/issues/5342 """ def self_referential_optional_within_method(self) -> None: @@ -121,7 +122,7 @@ class MyOtherClass: class MyThirdClass: """Class to test self referential variable typing within conditionals. - This regressed, reported in: https://github.com/PyCQA/pylint/issues/5499 + This regressed, reported in: https://github.com/pylint-dev/pylint/issues/5499 """ def function(self, var: int) -> None: @@ -134,7 +135,7 @@ class MyThirdClass: class MyFourthClass: # pylint: disable=too-few-public-methods """Class to test conditional imports guarded by TYPE_CHECKING two levels - up then used in function annotation. See https://github.com/PyCQA/pylint/issues/7539""" + up then used in function annotation. See https://github.com/pylint-dev/pylint/issues/7539""" def is_close(self, comparator: math.isclose, first, second): # [used-before-assignment] """Conditional imports guarded are only valid for variable annotations.""" @@ -145,8 +146,8 @@ class VariableAnnotationsGuardedByTypeChecking: # pylint: disable=too-few-publi """Class to test conditional imports guarded by TYPE_CHECKING then used in local (function) variable annotations, which are not evaluated at runtime. - See: https://github.com/PyCQA/pylint/issues/7609 - and https://github.com/PyCQA/pylint/issues/7882 + See: https://github.com/pylint-dev/pylint/issues/7609 + and https://github.com/pylint-dev/pylint/issues/7882 """ still_an_error: datetime.date # [used-before-assignment] diff --git a/tests/functional/u/used/used_before_assignment_typing.txt b/tests/functional/u/used/used_before_assignment_typing.txt index c0a31fae0..12794f0e9 100644 --- a/tests/functional/u/used/used_before_assignment_typing.txt +++ b/tests/functional/u/used/used_before_assignment_typing.txt @@ -1,5 +1,5 @@ -undefined-variable:68:21:68:28:MyClass.incorrect_typing_method:Undefined variable 'MyClass':UNDEFINED -undefined-variable:73:26:73:33:MyClass.incorrect_nested_typing_method:Undefined variable 'MyClass':UNDEFINED -undefined-variable:78:20:78:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED -used-before-assignment:139:35:139:39:MyFourthClass.is_close:Using variable 'math' before assignment:HIGH -used-before-assignment:152:20:152:28:VariableAnnotationsGuardedByTypeChecking:Using variable 'datetime' before assignment:HIGH +undefined-variable:69:21:69:28:MyClass.incorrect_typing_method:Undefined variable 'MyClass':UNDEFINED +undefined-variable:74:26:74:33:MyClass.incorrect_nested_typing_method:Undefined variable 'MyClass':UNDEFINED +undefined-variable:79:20:79:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED +used-before-assignment:140:35:140:39:MyFourthClass.is_close:Using variable 'math' before assignment:CONTROL_FLOW +used-before-assignment:153:20:153:28:VariableAnnotationsGuardedByTypeChecking:Using variable 'datetime' before assignment:CONTROL_FLOW diff --git a/tests/functional/u/useless/useless_parent_delegation.py b/tests/functional/u/useless/useless_parent_delegation.py index ce645e31f..b742a4e94 100644 --- a/tests/functional/u/useless/useless_parent_delegation.py +++ b/tests/functional/u/useless/useless_parent_delegation.py @@ -312,7 +312,7 @@ class DecoratedList(MyList): return super().__hash__() -# Reported in https://github.com/PyCQA/pylint/issues/2270 +# Reported in https://github.com/pylint-dev/pylint/issues/2270 class Super: def __init__(self, *args): self.args = args diff --git a/tests/functional/u/useless/useless_suppression.py b/tests/functional/u/useless/useless_suppression.py index b5c681eef..627138b50 100644 --- a/tests/functional/u/useless/useless_suppression.py +++ b/tests/functional/u/useless/useless_suppression.py @@ -3,14 +3,14 @@ # pylint: disable=unused-import, wrong-import-order, wrong-import-position # False positive for wrong-import-order -# Reported in https://github.com/PyCQA/pylint/issues/2366 +# Reported in https://github.com/pylint-dev/pylint/issues/2366 from pylint import run_pylint import astroid # False-positive for 'line-too-long' -# Reported in https://github.com/PyCQA/pylint/issues/4212 +# Reported in https://github.com/pylint-dev/pylint/issues/4212 VAR = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # pylint: disable=line-too-long # False-positive for 'wrong-import-order' -# Reported in https://github.com/PyCQA/pylint/issues/5219 +# Reported in https://github.com/pylint-dev/pylint/issues/5219 import os diff --git a/tests/input/func_noerror_cycle/__init__.py b/tests/input/func_noerror_cycle/__init__.py index fd8d14ec2..0a0ca7e19 100644 --- a/tests/input/func_noerror_cycle/__init__.py +++ b/tests/input/func_noerror_cycle/__init__.py @@ -1,3 +1,3 @@ -# https://github.com/PyCQA/pylint/issues/3525 +# https://github.com/pylint-dev/pylint/issues/3525 # `cyclic-import` should not be emitted if one import # is guarded by `typing.TYPE_CHECKING` diff --git a/tests/lint/__init__.py b/tests/lint/__init__.py index e8a8ff79f..cfd18ddd3 100644 --- a/tests/lint/__init__.py +++ b/tests/lint/__init__.py @@ -1,3 +1,3 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt diff --git a/tests/lint/test_caching.py b/tests/lint/test_caching.py index 55c2b54dd..e891f6810 100644 --- a/tests/lint/test_caching.py +++ b/tests/lint/test_caching.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # Pytest fixtures work like this by design # pylint: disable=redefined-outer-name diff --git a/tests/lint/test_pylinter.py b/tests/lint/test_pylinter.py index 1d0f43819..1e4f40a00 100644 --- a/tests/lint/test_pylinter.py +++ b/tests/lint/test_pylinter.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import os from pathlib import Path @@ -8,8 +8,6 @@ from typing import Any, NoReturn from unittest import mock from unittest.mock import patch -import pytest -from _pytest.recwarn import WarningsRecorder from pytest import CaptureFixture from pylint.lint.pylinter import PyLinter @@ -24,10 +22,8 @@ def raise_exception(*args: Any, **kwargs: Any) -> NoReturn: def test_crash_in_file( linter: PyLinter, capsys: CaptureFixture[str], tmp_path: Path ) -> None: - with pytest.warns(DeprecationWarning): - args = linter.load_command_line_configuration([__file__]) linter.crash_file_path = str(tmp_path / "pylint-crash-%Y") - linter.check(args) + linter.check([__file__]) out, err = capsys.readouterr() assert not out assert not err @@ -37,12 +33,6 @@ def test_crash_in_file( assert any(m.symbol == "fatal" for m in linter.reporter.messages) -def test_check_deprecation(linter: PyLinter, recwarn: WarningsRecorder) -> None: - linter.check("myfile.py") - msg = recwarn.pop() - assert "check function will only accept sequence" in str(msg) - - def test_crash_during_linting( linter: PyLinter, capsys: CaptureFixture[str], tmp_path: Path ) -> None: diff --git a/tests/lint/test_run_pylint.py b/tests/lint/test_run_pylint.py index 73dc26331..5057f1343 100644 --- a/tests/lint/test_run_pylint.py +++ b/tests/lint/test_run_pylint.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pathlib import Path diff --git a/tests/lint/test_utils.py b/tests/lint/test_utils.py index 872919f72..fa449374a 100644 --- a/tests/lint/test_utils.py +++ b/tests/lint/test_utils.py @@ -1,12 +1,13 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import unittest.mock from pathlib import Path, PosixPath import pytest +from pylint.constants import full_version from pylint.lint.utils import get_fatal_error_message, prepare_crash_report from pylint.testutils._run import _Run as Run @@ -17,19 +18,22 @@ def test_prepare_crash_report(tmp_path: PosixPath) -> None: python_content = "from shadok import MagicFaucet" with open(python_file, "w", encoding="utf8") as f: f.write(python_content) + template_path = None try: - raise Exception(exception_content) # pylint: disable=broad-exception-raised - except Exception as ex: # pylint: disable=broad-except + raise ValueError(exception_content) + except ValueError as ex: template_path = prepare_crash_report( ex, str(python_file), str(tmp_path / "pylint-crash-%Y.txt") ) - assert str(tmp_path) in str(template_path) # pylint: disable=used-before-assignment + assert str(tmp_path) in str(template_path) with open(template_path, encoding="utf8") as f: template_content = f.read() assert python_content in template_content assert exception_content in template_content assert "in test_prepare_crash_report" in template_content - assert "raise Exception(exception_content)" in template_content + assert "raise ValueError(exception_content)" in template_content + assert "<details open>" in template_content + assert full_version in template_content def test_get_fatal_error_message() -> None: diff --git a/tests/lint/unittest_expand_modules.py b/tests/lint/unittest_expand_modules.py index a8c46498c..7120a1748 100644 --- a/tests/lint/unittest_expand_modules.py +++ b/tests/lint/unittest_expand_modules.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py index d3faa5453..918533795 100644 --- a/tests/lint/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -1,42 +1,38 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name from __future__ import annotations import argparse -import datetime import os import re import sys import tempfile from collections.abc import Iterator from contextlib import contextmanager -from importlib import reload from io import StringIO from os import chdir, getcwd from os.path import abspath, dirname, join, sep from pathlib import Path from shutil import copy, rmtree +from unittest import mock import platformdirs import pytest from astroid import nodes from pytest import CaptureFixture -from pylint import checkers, config, exceptions, interfaces, lint, testutils +from pylint import checkers, constants, exceptions, interfaces, lint, testutils from pylint.checkers.utils import only_required_for_messages from pylint.constants import ( MSG_STATE_CONFIDENCE, MSG_STATE_SCOPE_CONFIG, MSG_STATE_SCOPE_MODULE, - OLD_DEFAULT_PYLINT_HOME, PYLINT_HOME, - USER_HOME, _get_pylint_home, - _warn_about_old_home, ) from pylint.exceptions import InvalidMessageError from pylint.lint import PyLinter, expand_modules @@ -116,15 +112,6 @@ def fake_path() -> Iterator[list[str]]: sys.path[:] = orig -def test_deprecated() -> None: - """Test that fix_import_path() and get_python_path() are deprecated""" - with tempdir(): - create_files(["__init__.py"]) - with pytest.deprecated_call(): - with lint.fix_import_path([""]): - expand_modules.get_python_path("__init__.py") - - def test_no_args(fake_path: list[str]) -> None: with lint.augmented_sys_path([]): assert sys.path == fake_path @@ -137,7 +124,7 @@ def test_no_args(fake_path: list[str]) -> None: def test_one_arg(fake_path: list[str], case: list[str]) -> None: with tempdir() as chroot: create_files(["a/b/__init__.py"]) - expected = [join(chroot, "a")] + fake_path + expected = [join(chroot, "a"), *fake_path] extra_sys_paths = [ expand_modules.discover_package_path(arg, []) for arg in case @@ -161,7 +148,7 @@ def test_one_arg(fake_path: list[str], case: list[str]) -> None: def test_two_similar_args(fake_path: list[str], case: list[str]) -> None: with tempdir() as chroot: create_files(["a/b/__init__.py", "a/c/__init__.py"]) - expected = [join(chroot, "a")] + fake_path + expected = [join(chroot, "a"), *fake_path] extra_sys_paths = [ expand_modules.discover_package_path(arg, []) for arg in case @@ -940,126 +927,14 @@ def pop_pylintrc() -> None: @pytest.mark.usefixtures("pop_pylintrc") def test_pylint_home() -> None: - uhome = os.path.expanduser("~") - if uhome == "~": - expected = OLD_DEFAULT_PYLINT_HOME - else: - expected = platformdirs.user_cache_dir("pylint") - assert config.PYLINT_HOME == expected + expected = platformdirs.user_cache_dir("pylint") + assert constants.PYLINT_HOME == expected assert PYLINT_HOME == expected +@mock.patch.dict(os.environ, {"PYLINTHOME": "whatever.d"}) def test_pylint_home_from_environ() -> None: - try: - pylintd = join(tempfile.gettempdir(), OLD_DEFAULT_PYLINT_HOME) - os.environ["PYLINTHOME"] = pylintd - try: - assert _get_pylint_home() == pylintd - finally: - try: - rmtree(pylintd) - except FileNotFoundError: - pass - finally: - del os.environ["PYLINTHOME"] - - -def test_warn_about_old_home(capsys: CaptureFixture[str]) -> None: - """Test that we correctly warn about old_home.""" - # Create old home - old_home = Path(USER_HOME) / OLD_DEFAULT_PYLINT_HOME - old_home.mkdir(parents=True, exist_ok=True) - - # Create spam prevention file - ten_years_ago = datetime.datetime.now() - datetime.timedelta(weeks=520) - new_prevention_file = Path(PYLINT_HOME) / ten_years_ago.strftime( - "pylint_warned_about_old_cache_already_%Y-%m-%d.temp" - ) - with open(new_prevention_file, "w", encoding="utf8") as f: - f.write("") - - # Remove current prevention file - cur_prevention_file = Path(PYLINT_HOME) / datetime.datetime.now().strftime( - "pylint_warned_about_old_cache_already_%Y-%m-%d.temp" - ) - if cur_prevention_file.exists(): - os.remove(cur_prevention_file) - - _warn_about_old_home(Path(PYLINT_HOME)) - - assert not new_prevention_file.exists() - assert cur_prevention_file.exists() - - out = capsys.readouterr() - assert "PYLINTHOME is now" in out.err - - -@pytest.mark.usefixtures("pop_pylintrc") -def test_pylintrc() -> None: - with fake_home(): - current_dir = getcwd() - chdir(os.path.dirname(os.path.abspath(sys.executable))) - # pylint: disable = too-many-try-statements - try: - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() is None - os.environ["PYLINTRC"] = join(tempfile.gettempdir(), ".pylintrc") - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() is None - os.environ["PYLINTRC"] = "." - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() is None - finally: - chdir(current_dir) - reload(config) - - -@pytest.mark.usefixtures("pop_pylintrc") -def test_pylintrc_parentdir() -> None: - with tempdir() as chroot: - create_files( - [ - "a/pylintrc", - "a/b/__init__.py", - "a/b/pylintrc", - "a/b/c/__init__.py", - "a/b/c/d/__init__.py", - "a/b/c/d/e/.pylintrc", - ] - ) - with fake_home(): - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() is None - results = { - "a": join(chroot, "a", "pylintrc"), - "a/b": join(chroot, "a", "b", "pylintrc"), - "a/b/c": join(chroot, "a", "b", "pylintrc"), - "a/b/c/d": join(chroot, "a", "b", "pylintrc"), - "a/b/c/d/e": join(chroot, "a", "b", "c", "d", "e", ".pylintrc"), - } - for basedir, expected in results.items(): - os.chdir(join(chroot, basedir)) - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() == expected - - -@pytest.mark.usefixtures("pop_pylintrc") -def test_pylintrc_parentdir_no_package() -> None: - with tempdir() as chroot: - with fake_home(): - create_files(["a/pylintrc", "a/b/pylintrc", "a/b/c/d/__init__.py"]) - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() is None - results = { - "a": join(chroot, "a", "pylintrc"), - "a/b": join(chroot, "a", "b", "pylintrc"), - "a/b/c": None, - "a/b/c/d": None, - } - for basedir, expected in results.items(): - os.chdir(join(chroot, basedir)) - with pytest.warns(DeprecationWarning): - assert config.find_pylintrc() == expected + assert _get_pylint_home() == "whatever.d" class _CustomPyLinter(PyLinter): @@ -1267,7 +1142,7 @@ def test_globbing() -> None: def test_relative_imports(initialized_linter: PyLinter) -> None: - """Regression test for https://github.com/PyCQA/pylint/issues/3651""" + """Regression test for https://github.com/pylint-dev/pylint/issues/3651""" linter = initialized_linter with tempdir() as tmpdir: create_files(["x/y/__init__.py", "x/y/one.py", "x/y/two.py"], tmpdir) @@ -1322,7 +1197,7 @@ print(submodule1) def test_lint_namespace_package_under_dir(initialized_linter: PyLinter) -> None: - """Regression test for https://github.com/PyCQA/pylint/issues/1667""" + """Regression test for https://github.com/pylint-dev/pylint/issues/1667""" linter = initialized_linter with tempdir(): create_files(["outer/namespace/__init__.py", "outer/namespace/module.py"]) diff --git a/tests/message/__init__.py b/tests/message/__init__.py index e8a8ff79f..cfd18ddd3 100644 --- a/tests/message/__init__.py +++ b/tests/message/__init__.py @@ -1,3 +1,3 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt diff --git a/tests/message/conftest.py b/tests/message/conftest.py index e41057835..57567f438 100644 --- a/tests/message/conftest.py +++ b/tests/message/conftest.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name diff --git a/tests/message/test_no_removed_msgid_or_symbol_used.py b/tests/message/test_no_removed_msgid_or_symbol_used.py index 3b0134235..7b13dc460 100644 --- a/tests/message/test_no_removed_msgid_or_symbol_used.py +++ b/tests/message/test_no_removed_msgid_or_symbol_used.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pylint.lint import PyLinter from pylint.message._deleted_message_ids import DELETED_MESSAGES_IDS @@ -10,7 +10,7 @@ def test_no_removed_msgid_or_symbol_used(linter: PyLinter) -> None: """Tests that we're not using deleted msgid or symbol. This could cause occasional bugs, but more importantly confusion and inconsistencies - when searching for old msgids online. See https://github.com/PyCQA/pylint/issues/5729 + when searching for old msgids online. See https://github.com/pylint-dev/pylint/issues/5729 """ for deleted_messages in DELETED_MESSAGES_IDS.values(): for msgid, symbol, old_names in deleted_messages: diff --git a/tests/message/unittest_message.py b/tests/message/unittest_message.py index edb803daf..6fddd804c 100644 --- a/tests/message/unittest_message.py +++ b/tests/message/unittest_message.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/message/unittest_message_definition.py b/tests/message/unittest_message_definition.py index aebd1bc6b..6c393b519 100644 --- a/tests/message/unittest_message_definition.py +++ b/tests/message/unittest_message_definition.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/message/unittest_message_definition_store.py b/tests/message/unittest_message_definition_store.py index eb323a2e6..a8a0043fa 100644 --- a/tests/message/unittest_message_definition_store.py +++ b/tests/message/unittest_message_definition_store.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/message/unittest_message_id_store.py b/tests/message/unittest_message_id_store.py index 9dcf774e5..c2b556ac9 100644 --- a/tests/message/unittest_message_id_store.py +++ b/tests/message/unittest_message_id_store.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/primer/__main__.py b/tests/primer/__main__.py index 1e99ca234..260306237 100644 --- a/tests/primer/__main__.py +++ b/tests/primer/__main__.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/primer/packages_to_lint_batch_one.json b/tests/primer/packages_to_lint_batch_one.json deleted file mode 100644 index 6520e2bd1..000000000 --- a/tests/primer/packages_to_lint_batch_one.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "keras": { - "branch": "master", - "directories": ["keras"], - "url": "https://github.com/keras-team/keras.git" - } -} diff --git a/tests/primer/packages_to_prime.json b/tests/primer/packages_to_prime.json index fa1457773..a7c2796e7 100644 --- a/tests/primer/packages_to_prime.json +++ b/tests/primer/packages_to_prime.json @@ -2,7 +2,7 @@ "astroid": { "branch": "main", "directories": ["astroid"], - "url": "https://github.com/PyCQA/astroid", + "url": "https://github.com/pylint-dev/astroid", "pylintrc_relpath": "pylintrc" }, "black": { @@ -20,6 +20,11 @@ "directories": ["src/flask"], "url": "https://github.com/pallets/flask" }, + "home-assistant": { + "branch": "dev", + "directories": ["homeassistant"], + "url": "https://github.com/home-assistant/core.git" + }, "music21": { "branch": "master", "directories": ["music21"], diff --git a/tests/primer/test_primer_external.py b/tests/primer/test_primer_external.py deleted file mode 100644 index 01b1367b1..000000000 --- a/tests/primer/test_primer_external.py +++ /dev/null @@ -1,73 +0,0 @@ -# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt - -from __future__ import annotations - -import json -import logging -import subprocess -from pathlib import Path - -import pytest -from pytest import LogCaptureFixture - -from pylint.testutils._primer import PackageToLint - -PRIMER_DIRECTORY = (Path("tests") / ".pylint_primer_tests/").resolve() - - -def get_packages_to_lint_from_json(json_path: Path | str) -> dict[str, PackageToLint]: - with open(json_path, encoding="utf8") as f: - return { - name: PackageToLint(**package_data) - for name, package_data in json.load(f).items() - } - - -PACKAGE_TO_LINT_JSON_BATCH_ONE = ( - Path(__file__).parent / "packages_to_lint_batch_one.json" -) -PACKAGES_TO_LINT_BATCH_ONE = get_packages_to_lint_from_json( - PACKAGE_TO_LINT_JSON_BATCH_ONE -) -"""Dictionary of external packages used during the primer test in batch one.""" - - -class TestPrimer: - @staticmethod - @pytest.mark.primer_external_batch_one - @pytest.mark.parametrize( - "package", PACKAGES_TO_LINT_BATCH_ONE.values(), ids=PACKAGES_TO_LINT_BATCH_ONE - ) - def test_primer_external_packages_no_crash_batch_one( - package: PackageToLint, - caplog: LogCaptureFixture, - ) -> None: - __tracebackhide__ = True # pylint: disable=unused-variable - TestPrimer._primer_test(package, caplog) - - @staticmethod - def _primer_test(package: PackageToLint, caplog: LogCaptureFixture) -> None: - """Runs pylint over external packages to check for crashes and fatal messages. - - We only check for crashes (bit-encoded exit code 32) and fatal messages - (bit-encoded exit code 1). We assume that these external repositories do not - have any fatal errors in their code so that any fatal errors are pylint false - positives - """ - caplog.set_level(logging.INFO) - package.lazy_clone() - - try: - # We want to test all the code we can - enables = ["--enable-all-extensions", "--enable=all"] - # Duplicate code takes too long and is relatively safe - disables = ["--disable=duplicate-code"] - command = ["pylint"] + enables + disables + package.pylint_args - logging.info("Launching primer:\n%s", " ".join(command)) - subprocess.run(command, check=True) - except subprocess.CalledProcessError as ex: - msg = f"Encountered {{}} during primer test for {package}" - assert ex.returncode != 32, msg.format("a crash") - assert ex.returncode % 2 == 0, msg.format("a message of category 'fatal'") diff --git a/tests/primer/test_primer_stdlib.py b/tests/primer/test_primer_stdlib.py index c2d879764..ea5581749 100644 --- a/tests/primer/test_primer_stdlib.py +++ b/tests/primer/test_primer_stdlib.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -63,7 +63,7 @@ def test_primer_stdlib_no_crash( disables = ["--disable=duplicate-code", "--ignore=test"] with warnings.catch_warnings(): warnings.simplefilter("ignore", category=UserWarning) - Run([test_module_name] + enables + disables) + Run([test_module_name, *enables, *disables]) except SystemExit as ex: out, err = capsys.readouterr() assert not err, err diff --git a/tests/profile/test_profile_against_externals.py b/tests/profile/test_profile_against_externals.py index 3ee7564f0..b646ede90 100644 --- a/tests/profile/test_profile_against_externals.py +++ b/tests/profile/test_profile_against_externals.py @@ -1,8 +1,8 @@ """Profiles basic -jX functionality.""" # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=missing-function-docstring diff --git a/tests/pyreverse/conftest.py b/tests/pyreverse/conftest.py index 02a19e613..9e1741f0a 100644 --- a/tests/pyreverse/conftest.py +++ b/tests/pyreverse/conftest.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -29,9 +29,10 @@ def colorized_dot_config() -> PyreverseConfig: @pytest.fixture() -def vcg_config() -> PyreverseConfig: +def no_standalone_dot_config() -> PyreverseConfig: return PyreverseConfig( - output_format="vcg", + output_format="dot", + no_standalone=True, ) diff --git a/tests/pyreverse/data/classes_No_Name.dot b/tests/pyreverse/data/classes_No_Name.dot index 2e8830fa0..a33f65da3 100644 --- a/tests/pyreverse/data/classes_No_Name.dot +++ b/tests/pyreverse/data/classes_No_Name.dot @@ -11,7 +11,6 @@ charset="utf-8" "data.property_pattern.PropertyPatterns" [color="black", fontcolor="black", label=<{PropertyPatterns|prop1<br ALIGN="LEFT"/>prop2<br ALIGN="LEFT"/>|}>, shape="record", style="solid"]; "data.clientmodule_test.Specialization" [color="black", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="solid"]; "data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"]; -"data.clientmodule_test.Ancestor" -> "data.suppliermodule_test.Interface" [arrowhead="empty", arrowtail="node", style="dashed"]; "data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"]; "data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"]; "data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"]; diff --git a/tests/pyreverse/data/classes_No_Name.html b/tests/pyreverse/data/classes_No_Name.html index bed9a8d14..bf4c17d0d 100644 --- a/tests/pyreverse/data/classes_No_Name.html +++ b/tests/pyreverse/data/classes_No_Name.html @@ -44,7 +44,6 @@ transform_value(value: int) int } Specialization --|> Ancestor - Ancestor ..|> Interface DoNothing --* Ancestor : cls_member DoNothing --* Specialization : relation DoNothing2 --o Specialization : relation2 diff --git a/tests/pyreverse/data/classes_No_Name.mmd b/tests/pyreverse/data/classes_No_Name.mmd index 53cb4fc3c..9f38089de 100644 --- a/tests/pyreverse/data/classes_No_Name.mmd +++ b/tests/pyreverse/data/classes_No_Name.mmd @@ -39,7 +39,6 @@ classDiagram transform_value(value: int) int } Specialization --|> Ancestor - Ancestor ..|> Interface DoNothing --* Ancestor : cls_member DoNothing --* Specialization : relation DoNothing2 --o Specialization : relation2 diff --git a/tests/pyreverse/data/classes_No_Name.puml b/tests/pyreverse/data/classes_No_Name.puml index e4d06a00c..0b01169e4 100644 --- a/tests/pyreverse/data/classes_No_Name.puml +++ b/tests/pyreverse/data/classes_No_Name.puml @@ -40,7 +40,6 @@ class "Specialization" as data.clientmodule_test.Specialization { transform_value(value: int) -> int } data.clientmodule_test.Specialization --|> data.clientmodule_test.Ancestor -data.clientmodule_test.Ancestor ..|> data.suppliermodule_test.Interface data.suppliermodule_test.DoNothing --* data.clientmodule_test.Ancestor : cls_member data.suppliermodule_test.DoNothing --* data.clientmodule_test.Specialization : relation data.suppliermodule_test.DoNothing2 --o data.clientmodule_test.Specialization : relation2 diff --git a/tests/pyreverse/data/classes_colorized.dot b/tests/pyreverse/data/classes_colorized.dot index 49dc8a7e1..729b05828 100644 --- a/tests/pyreverse/data/classes_colorized.dot +++ b/tests/pyreverse/data/classes_colorized.dot @@ -1,17 +1,16 @@ digraph "classes_colorized" { rankdir=BT charset="utf-8" -"data.clientmodule_test.Ancestor" [color="aliceblue", fontcolor="black", label=<{Ancestor|attr : str<br ALIGN="LEFT"/>cls_member<br ALIGN="LEFT"/>|get_value()<br ALIGN="LEFT"/>set_value(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; -"data.suppliermodule_test.CustomException" [color="aliceblue", fontcolor="red", label=<{CustomException|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; -"data.suppliermodule_test.DoNothing" [color="aliceblue", fontcolor="black", label=<{DoNothing|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; -"data.suppliermodule_test.DoNothing2" [color="aliceblue", fontcolor="black", label=<{DoNothing2|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; -"data.suppliermodule_test.DoSomething" [color="aliceblue", fontcolor="black", label=<{DoSomething|my_int : Optional[int]<br ALIGN="LEFT"/>my_int_2 : Optional[int]<br ALIGN="LEFT"/>my_string : str<br ALIGN="LEFT"/>|do_it(new_int: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; -"data.suppliermodule_test.Interface" [color="aliceblue", fontcolor="black", label=<{Interface|<br ALIGN="LEFT"/>|<I>get_value</I>()<br ALIGN="LEFT"/><I>set_value</I>(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; -"data.nullable_pattern.NullablePatterns" [color="aliceblue", fontcolor="black", label=<{NullablePatterns|<br ALIGN="LEFT"/>|<I>return_nullable_1</I>(): int \| None<br ALIGN="LEFT"/><I>return_nullable_2</I>(): Optional[int]<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; -"data.property_pattern.PropertyPatterns" [color="aliceblue", fontcolor="black", label=<{PropertyPatterns|prop1<br ALIGN="LEFT"/>prop2<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; -"data.clientmodule_test.Specialization" [color="aliceblue", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"data.clientmodule_test.Ancestor" [color="#77AADD", fontcolor="black", label=<{Ancestor|attr : str<br ALIGN="LEFT"/>cls_member<br ALIGN="LEFT"/>|get_value()<br ALIGN="LEFT"/>set_value(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"data.suppliermodule_test.CustomException" [color="#77AADD", fontcolor="red", label=<{CustomException|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; +"data.suppliermodule_test.DoNothing" [color="#77AADD", fontcolor="black", label=<{DoNothing|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; +"data.suppliermodule_test.DoNothing2" [color="#77AADD", fontcolor="black", label=<{DoNothing2|<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; +"data.suppliermodule_test.DoSomething" [color="#77AADD", fontcolor="black", label=<{DoSomething|my_int : Optional[int]<br ALIGN="LEFT"/>my_int_2 : Optional[int]<br ALIGN="LEFT"/>my_string : str<br ALIGN="LEFT"/>|do_it(new_int: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"data.suppliermodule_test.Interface" [color="#77AADD", fontcolor="black", label=<{Interface|<br ALIGN="LEFT"/>|<I>get_value</I>()<br ALIGN="LEFT"/><I>set_value</I>(value)<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"data.nullable_pattern.NullablePatterns" [color="#77AADD", fontcolor="black", label=<{NullablePatterns|<br ALIGN="LEFT"/>|<I>return_nullable_1</I>(): int \| None<br ALIGN="LEFT"/><I>return_nullable_2</I>(): Optional[int]<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"data.property_pattern.PropertyPatterns" [color="#77AADD", fontcolor="black", label=<{PropertyPatterns|prop1<br ALIGN="LEFT"/>prop2<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; +"data.clientmodule_test.Specialization" [color="#77AADD", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; "data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"]; -"data.clientmodule_test.Ancestor" -> "data.suppliermodule_test.Interface" [arrowhead="empty", arrowtail="node", style="dashed"]; "data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"]; "data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"]; "data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"]; diff --git a/tests/pyreverse/data/classes_colorized.puml b/tests/pyreverse/data/classes_colorized.puml index 9c046afa0..ef97398bc 100644 --- a/tests/pyreverse/data/classes_colorized.puml +++ b/tests/pyreverse/data/classes_colorized.puml @@ -1,36 +1,36 @@ @startuml classes_colorized set namespaceSeparator none -class "Ancestor" as data.clientmodule_test.Ancestor #aliceblue { +class "Ancestor" as data.clientmodule_test.Ancestor #77AADD { attr : str cls_member get_value() set_value(value) } -class "<color:red>CustomException</color>" as data.suppliermodule_test.CustomException #aliceblue { +class "<color:red>CustomException</color>" as data.suppliermodule_test.CustomException #77AADD { } -class "DoNothing" as data.suppliermodule_test.DoNothing #aliceblue { +class "DoNothing" as data.suppliermodule_test.DoNothing #77AADD { } -class "DoNothing2" as data.suppliermodule_test.DoNothing2 #aliceblue { +class "DoNothing2" as data.suppliermodule_test.DoNothing2 #77AADD { } -class "DoSomething" as data.suppliermodule_test.DoSomething #aliceblue { +class "DoSomething" as data.suppliermodule_test.DoSomething #77AADD { my_int : Optional[int] my_int_2 : Optional[int] my_string : str do_it(new_int: int) -> int } -class "Interface" as data.suppliermodule_test.Interface #aliceblue { +class "Interface" as data.suppliermodule_test.Interface #77AADD { {abstract}get_value() {abstract}set_value(value) } -class "NullablePatterns" as data.nullable_pattern.NullablePatterns #aliceblue { +class "NullablePatterns" as data.nullable_pattern.NullablePatterns #77AADD { {abstract}return_nullable_1() -> int | None {abstract}return_nullable_2() -> Optional[int] } -class "PropertyPatterns" as data.property_pattern.PropertyPatterns #aliceblue { +class "PropertyPatterns" as data.property_pattern.PropertyPatterns #77AADD { prop1 prop2 } -class "Specialization" as data.clientmodule_test.Specialization #aliceblue { +class "Specialization" as data.clientmodule_test.Specialization #77AADD { TYPE : str relation relation2 @@ -40,7 +40,6 @@ class "Specialization" as data.clientmodule_test.Specialization #aliceblue { transform_value(value: int) -> int } data.clientmodule_test.Specialization --|> data.clientmodule_test.Ancestor -data.clientmodule_test.Ancestor ..|> data.suppliermodule_test.Interface data.suppliermodule_test.DoNothing --* data.clientmodule_test.Ancestor : cls_member data.suppliermodule_test.DoNothing --* data.clientmodule_test.Specialization : relation data.suppliermodule_test.DoNothing2 --o data.clientmodule_test.Specialization : relation2 diff --git a/tests/pyreverse/data/classes_no_standalone.dot b/tests/pyreverse/data/classes_no_standalone.dot new file mode 100644 index 000000000..7cffc0a38 --- /dev/null +++ b/tests/pyreverse/data/classes_no_standalone.dot @@ -0,0 +1,12 @@ +digraph "classes_no_standalone" { +rankdir=BT +charset="utf-8" +"data.clientmodule_test.Ancestor" [color="black", fontcolor="black", label=<{Ancestor|attr : str<br ALIGN="LEFT"/>cls_member<br ALIGN="LEFT"/>|get_value()<br ALIGN="LEFT"/>set_value(value)<br ALIGN="LEFT"/>}>, shape="record", style="solid"]; +"data.suppliermodule_test.DoNothing" [color="black", fontcolor="black", label=<{DoNothing|<br ALIGN="LEFT"/>|}>, shape="record", style="solid"]; +"data.suppliermodule_test.DoNothing2" [color="black", fontcolor="black", label=<{DoNothing2|<br ALIGN="LEFT"/>|}>, shape="record", style="solid"]; +"data.clientmodule_test.Specialization" [color="black", fontcolor="black", label=<{Specialization|TYPE : str<br ALIGN="LEFT"/>relation<br ALIGN="LEFT"/>relation2<br ALIGN="LEFT"/>top : str<br ALIGN="LEFT"/>|from_value(value: int)<br ALIGN="LEFT"/>increment_value(): None<br ALIGN="LEFT"/>transform_value(value: int): int<br ALIGN="LEFT"/>}>, shape="record", style="solid"]; +"data.clientmodule_test.Specialization" -> "data.clientmodule_test.Ancestor" [arrowhead="empty", arrowtail="none"]; +"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Ancestor" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"]; +"data.suppliermodule_test.DoNothing" -> "data.clientmodule_test.Specialization" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"]; +"data.suppliermodule_test.DoNothing2" -> "data.clientmodule_test.Specialization" [arrowhead="odiamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"]; +} diff --git a/tests/pyreverse/data/packages_colorized.dot b/tests/pyreverse/data/packages_colorized.dot index eacc932b1..202c9a4e5 100644 --- a/tests/pyreverse/data/packages_colorized.dot +++ b/tests/pyreverse/data/packages_colorized.dot @@ -1,10 +1,10 @@ digraph "packages_colorized" { rankdir=BT charset="utf-8" -"data" [color="aliceblue", label=<data>, shape="box", style="filled"]; -"data.clientmodule_test" [color="aliceblue", label=<data.clientmodule_test>, shape="box", style="filled"]; -"data.nullable_pattern" [color="aliceblue", label=<data.nullable_pattern>, shape="box", style="filled"]; -"data.property_pattern" [color="aliceblue", label=<data.property_pattern>, shape="box", style="filled"]; -"data.suppliermodule_test" [color="aliceblue", label=<data.suppliermodule_test>, shape="box", style="filled"]; +"data" [color="#77AADD", label=<data>, shape="box", style="filled"]; +"data.clientmodule_test" [color="#77AADD", label=<data.clientmodule_test>, shape="box", style="filled"]; +"data.nullable_pattern" [color="#77AADD", label=<data.nullable_pattern>, shape="box", style="filled"]; +"data.property_pattern" [color="#77AADD", label=<data.property_pattern>, shape="box", style="filled"]; +"data.suppliermodule_test" [color="#77AADD", label=<data.suppliermodule_test>, shape="box", style="filled"]; "data.clientmodule_test" -> "data.suppliermodule_test" [arrowhead="open", arrowtail="none"]; } diff --git a/tests/pyreverse/data/packages_colorized.puml b/tests/pyreverse/data/packages_colorized.puml index 1066a9448..639c0654f 100644 --- a/tests/pyreverse/data/packages_colorized.puml +++ b/tests/pyreverse/data/packages_colorized.puml @@ -1,19 +1,14 @@ @startuml packages_colorized set namespaceSeparator none -package "data" as data #aliceblue { - +package "data" as data #77AADD { } -package "data.clientmodule_test" as data.clientmodule_test #aliceblue { - +package "data.clientmodule_test" as data.clientmodule_test #77AADD { } -package "data.nullable_pattern" as data.nullable_pattern #aliceblue { - +package "data.nullable_pattern" as data.nullable_pattern #77AADD { } -package "data.property_pattern" as data.property_pattern #aliceblue { - +package "data.property_pattern" as data.property_pattern #77AADD { } -package "data.suppliermodule_test" as data.suppliermodule_test #aliceblue { - +package "data.suppliermodule_test" as data.suppliermodule_test #77AADD { } data.clientmodule_test --> data.suppliermodule_test @enduml diff --git a/tests/pyreverse/data/packages_no_standalone.dot b/tests/pyreverse/data/packages_no_standalone.dot new file mode 100644 index 000000000..008c9c5d0 --- /dev/null +++ b/tests/pyreverse/data/packages_no_standalone.dot @@ -0,0 +1,7 @@ +digraph "packages_no_standalone" { +rankdir=BT +charset="utf-8" +"data.clientmodule_test" [color="black", label=<data.clientmodule_test>, shape="box", style="solid"]; +"data.suppliermodule_test" [color="black", label=<data.suppliermodule_test>, shape="box", style="solid"]; +"data.clientmodule_test" -> "data.suppliermodule_test" [arrowhead="open", arrowtail="none"]; +} diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml b/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml index a5ccf11f7..10575159d 100644 --- a/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml +++ b/tests/pyreverse/functional/class_diagrams/colorized_output/colorized.puml @@ -1,18 +1,18 @@ @startuml classes set namespaceSeparator none -class "CheckerCollector" as colorized.CheckerCollector #aliceblue { +class "CheckerCollector" as colorized.CheckerCollector #77AADD { checker1 checker2 checker3 } -class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #antiquewhite { +class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #99DDFF { msgs : dict name : str leave_module(_: nodes.Module) -> None process_tokens(tokens: list[TokenInfo]) -> None visit_if(node: nodes.If) -> None } -class "ExceptionsChecker" as pylint.checkers.exceptions.ExceptionsChecker #aquamarine { +class "ExceptionsChecker" as pylint.checkers.exceptions.ExceptionsChecker #44BB99 { msgs : dict name : str options : tuple @@ -22,7 +22,7 @@ class "ExceptionsChecker" as pylint.checkers.exceptions.ExceptionsChecker #aquam visit_raise(node: nodes.Raise) -> None visit_tryexcept(node: nodes.TryExcept) -> None } -class "StdlibChecker" as pylint.checkers.stdlib.StdlibChecker #aquamarine { +class "StdlibChecker" as pylint.checkers.stdlib.StdlibChecker #44BB99 { msgs : dict[str, MessageDefinitionTuple] name : str deprecated_arguments(method: str) -> tuple[tuple[int | None, str], ...] diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot new file mode 100644 index 000000000..7263cf8f5 --- /dev/null +++ b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.dot @@ -0,0 +1,11 @@ +digraph "classes" { +rankdir=BT +charset="utf-8" +"custom_colors.CheckerCollector" [color="red", fontcolor="black", label=<{CheckerCollector|checker1<br ALIGN="LEFT"/>checker2<br ALIGN="LEFT"/>checker3<br ALIGN="LEFT"/>|}>, shape="record", style="filled"]; +"pylint.extensions.check_elif.ElseifUsedChecker" [color="#44BB88", fontcolor="black", label=<{ElseifUsedChecker|msgs : dict<br ALIGN="LEFT"/>name : str<br ALIGN="LEFT"/>|leave_module(_: nodes.Module): None<br ALIGN="LEFT"/>process_tokens(tokens: list[TokenInfo]): None<br ALIGN="LEFT"/>visit_if(node: nodes.If): None<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"pylint.checkers.exceptions.ExceptionsChecker" [color="yellow", fontcolor="black", label=<{ExceptionsChecker|msgs : dict<br ALIGN="LEFT"/>name : str<br ALIGN="LEFT"/>options : tuple<br ALIGN="LEFT"/>|open(): None<br ALIGN="LEFT"/>visit_binop(node: nodes.BinOp): None<br ALIGN="LEFT"/>visit_compare(node: nodes.Compare): None<br ALIGN="LEFT"/>visit_raise(node: nodes.Raise): None<br ALIGN="LEFT"/>visit_tryexcept(node: nodes.TryExcept): None<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"pylint.checkers.stdlib.StdlibChecker" [color="yellow", fontcolor="black", label=<{StdlibChecker|msgs : dict[str, MessageDefinitionTuple]<br ALIGN="LEFT"/>name : str<br ALIGN="LEFT"/>|deprecated_arguments(method: str): tuple[tuple[int \| None, str], ...]<br ALIGN="LEFT"/>deprecated_classes(module: str): Iterable[str]<br ALIGN="LEFT"/>deprecated_decorators(): Iterable[str]<br ALIGN="LEFT"/>deprecated_methods(): set[str]<br ALIGN="LEFT"/>visit_boolop(node: nodes.BoolOp): None<br ALIGN="LEFT"/>visit_call(node: nodes.Call): None<br ALIGN="LEFT"/>visit_functiondef(node: nodes.FunctionDef): None<br ALIGN="LEFT"/>visit_if(node: nodes.If): None<br ALIGN="LEFT"/>visit_ifexp(node: nodes.IfExp): None<br ALIGN="LEFT"/>visit_unaryop(node: nodes.UnaryOp): None<br ALIGN="LEFT"/>}>, shape="record", style="filled"]; +"pylint.checkers.exceptions.ExceptionsChecker" -> "custom_colors.CheckerCollector" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="checker1", style="solid"]; +"pylint.checkers.stdlib.StdlibChecker" -> "custom_colors.CheckerCollector" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="checker3", style="solid"]; +"pylint.extensions.check_elif.ElseifUsedChecker" -> "custom_colors.CheckerCollector" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="checker2", style="solid"]; +} diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml index 34dc814ff..f2cea9f63 100644 --- a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml +++ b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.puml @@ -5,7 +5,7 @@ class "CheckerCollector" as custom_colors.CheckerCollector #red { checker2 checker3 } -class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #green { +class "ElseifUsedChecker" as pylint.extensions.check_elif.ElseifUsedChecker #44BB88 { msgs : dict name : str leave_module(_: nodes.Module) -> None diff --git a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc index ea30ad4a4..08f68bbb3 100644 --- a/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc +++ b/tests/pyreverse/functional/class_diagrams/colorized_output/custom_colors.rc @@ -1,3 +1,3 @@ [testoptions] -output_formats=puml -command_line_args=-S --colorized --max-color-depth=2 --color-palette=red,green,yellow +output_formats=puml,dot +command_line_args=-S --colorized --max-color-depth=2 --color-palette=red,#44BB88,yellow diff --git a/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd new file mode 100644 index 000000000..646d8220d --- /dev/null +++ b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.mmd @@ -0,0 +1,6 @@ +classDiagram + class A { + } + class B { + } + B --|> A diff --git a/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py new file mode 100644 index 000000000..3d881d4c0 --- /dev/null +++ b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.py @@ -0,0 +1,5 @@ +class A: pass + +class B(A): pass + +class C: pass diff --git a/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc new file mode 100644 index 000000000..c17e41cfb --- /dev/null +++ b/tests/pyreverse/functional/class_diagrams/inheritance/no_standalone.rc @@ -0,0 +1,2 @@ +[testoptions] +command_line_args=--no-standalone diff --git a/tests/pyreverse/test_diadefs.py b/tests/pyreverse/test_diadefs.py index 96cafc2ef..cdcdea7c5 100644 --- a/tests/pyreverse/test_diadefs.py +++ b/tests/pyreverse/test_diadefs.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unit test for the extensions.diadefslib modules.""" @@ -13,7 +13,7 @@ from collections.abc import Iterator from pathlib import Path import pytest -from astroid import nodes +from astroid import extract_node, nodes from pylint.pyreverse.diadefslib import ( ClassDiadefGenerator, @@ -97,19 +97,61 @@ def test_default_values() -> None: # TODO : should test difference between default values for package or class diagrams +class TestShowOptions: + def test_show_stdlib(self) -> None: + example = extract_node( + ''' + import collections + + class CustomDict(collections.OrderedDict): + """docstring""" + ''' + ) + + config = PyreverseConfig() + dd_gen = DiaDefGenerator(Linker(PROJECT), DiadefsHandler(config)) + + # Default behavior + assert not list(dd_gen.get_ancestors(example, 1)) + + # Show standard library enabled + config.show_stdlib = True + ancestors = list(dd_gen.get_ancestors(example, 1)) + assert len(ancestors) == 1 + assert ancestors[0].name == "OrderedDict" + + def test_show_builtin(self) -> None: + example = extract_node( + ''' + class CustomError(Exception): + """docstring""" + ''' + ) + + config = PyreverseConfig() + dd_gen = DiaDefGenerator(Linker(PROJECT), DiadefsHandler(config)) + + # Default behavior + assert not list(dd_gen.get_ancestors(example, 1)) + + # Show builtin enabled + config.show_builtin = True + ancestors = list(dd_gen.get_ancestors(example, 1)) + assert len(ancestors) == 1 + assert ancestors[0].name == "Exception" + + class TestDefaultDiadefGenerator: _should_rels = [ ("aggregation", "DoNothing2", "Specialization"), ("association", "DoNothing", "Ancestor"), ("association", "DoNothing", "Specialization"), - ("implements", "Ancestor", "Interface"), ("specialization", "Specialization", "Ancestor"), ] def test_extract_relations(self, HANDLER: DiadefsHandler, PROJECT: Project) -> None: """Test extract_relations between classes.""" - with pytest.warns(DeprecationWarning): - cd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)[1] + cd = DefaultDiadefGenerator(Linker(PROJECT), HANDLER).visit(PROJECT)[1] cd.extract_relationships() relations = _process_relations(cd.relationships) assert relations == self._should_rels diff --git a/tests/pyreverse/test_diagrams.py b/tests/pyreverse/test_diagrams.py index 863bcecc9..761aa0692 100644 --- a/tests/pyreverse/test_diagrams.py +++ b/tests/pyreverse/test_diagrams.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unit test for the diagrams modules.""" diff --git a/tests/pyreverse/test_inspector.py b/tests/pyreverse/test_inspector.py index 54fff0896..d28d99584 100644 --- a/tests/pyreverse/test_inspector.py +++ b/tests/pyreverse/test_inspector.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """For the visitors.diadefs module.""" @@ -15,7 +15,6 @@ from pathlib import Path import astroid import pytest -from astroid import nodes from pylint.pyreverse import inspector from pylint.pyreverse.inspector import Project @@ -37,20 +36,6 @@ def project(get_project: GetProjectCallable) -> Generator[Project, None, None]: yield project -def test_class_implements(project: Project) -> None: - klass = project.get_module("data.clientmodule_test")["Ancestor"] - assert hasattr(klass, "implements") - assert len(klass.implements) == 1 - assert isinstance(klass.implements[0], nodes.ClassDef) - assert klass.implements[0].name == "Interface" - - -def test_class_implements_specialization(project: Project) -> None: - klass = project.get_module("data.clientmodule_test")["Specialization"] - assert hasattr(klass, "implements") - assert len(klass.implements) == 0 - - def test_locals_assignment_resolution(project: Project) -> None: klass = project.get_module("data.clientmodule_test")["Specialization"] assert hasattr(klass, "locals_type") @@ -78,54 +63,6 @@ def test_instance_attrs_resolution(project: Project) -> None: assert type_dict["_id"][0] is astroid.Uninferable -def test_concat_interfaces() -> None: - cls = astroid.extract_node( - ''' - class IMachin: pass - - class Correct2: - """docstring""" - __implements__ = (IMachin,) - - class BadArgument: - """docstring""" - __implements__ = (IMachin,) - - class InterfaceCanNowBeFound: #@ - """docstring""" - __implements__ = BadArgument.__implements__ + Correct2.__implements__ - ''' - ) - interfaces = inspector.interfaces(cls) - assert [i.name for i in interfaces] == ["IMachin"] - - -def test_interfaces() -> None: - module = astroid.parse( - """ - class Interface(object): pass - class MyIFace(Interface): pass - class AnotherIFace(Interface): pass - class Concrete0(object): - __implements__ = MyIFace - class Concrete1: - __implements__ = (MyIFace, AnotherIFace) - class Concrete2: - __implements__ = (MyIFace, AnotherIFace) - class Concrete23(Concrete1): pass - """ - ) - - for klass, interfaces in ( - ("Concrete0", ["MyIFace"]), - ("Concrete1", ["MyIFace", "AnotherIFace"]), - ("Concrete2", ["MyIFace", "AnotherIFace"]), - ("Concrete23", []), - ): - klass = module[klass] - assert [i.name for i in inspector.interfaces(klass)] == interfaces - - def test_from_directory(project: Project) -> None: expected = os.path.join("tests", "data", "__init__.py") assert project.name == "data" @@ -141,18 +78,3 @@ def test_project_node(project: Project) -> None: "data.suppliermodule_test", ] assert sorted(project.keys()) == expected - - -def test_interface_deprecation(project: Project) -> None: - linker = inspector.Linker(project) - cls = astroid.extract_node( - ''' - class IMachin: pass - - class Concrete: #@ - """docstring""" - __implements__ = (IMachin,) - ''' - ) - with pytest.warns(DeprecationWarning): - linker.visit_classdef(cls) diff --git a/tests/pyreverse/test_main.py b/tests/pyreverse/test_main.py index 86401e05b..350550585 100644 --- a/tests/pyreverse/test_main.py +++ b/tests/pyreverse/test_main.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unittest for the main module.""" @@ -138,6 +138,7 @@ def test_graphviz_unsupported_image_format(capsys: CaptureFixture) -> None: ("show_associated", None), ("all_associated", None), ("show_builtin", 0), + ("show_stdlib", 0), ("module_names", None), ("output_format", "dot"), ("colorized", 0), diff --git a/tests/pyreverse/test_printer.py b/tests/pyreverse/test_printer.py index 4248e8bae..67b4186b8 100644 --- a/tests/pyreverse/test_printer.py +++ b/tests/pyreverse/test_printer.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations @@ -10,7 +10,6 @@ from astroid import nodes from pylint.pyreverse.dot_printer import DotPrinter from pylint.pyreverse.plantuml_printer import PlantUmlPrinter from pylint.pyreverse.printer import Layout, NodeType, Printer -from pylint.pyreverse.vcg_printer import VCGPrinter @pytest.mark.parametrize( @@ -20,10 +19,6 @@ from pylint.pyreverse.vcg_printer import VCGPrinter (Layout.BOTTOM_TO_TOP, DotPrinter, "rankdir=BT", -2), (Layout.LEFT_TO_RIGHT, DotPrinter, "rankdir=LR", -2), (Layout.RIGHT_TO_LEFT, DotPrinter, "rankdir=RL", -2), - (Layout.TOP_TO_BOTTOM, VCGPrinter, "orientation:top_to_bottom", -1), - (Layout.BOTTOM_TO_TOP, VCGPrinter, "orientation:bottom_to_top", -1), - (Layout.LEFT_TO_RIGHT, VCGPrinter, "orientation:left_to_right", -1), - (Layout.RIGHT_TO_LEFT, VCGPrinter, "orientation:right_to_left", -1), (Layout.TOP_TO_BOTTOM, PlantUmlPrinter, "top to bottom direction", -1), (Layout.LEFT_TO_RIGHT, PlantUmlPrinter, "left to right direction", -1), ], @@ -45,8 +40,15 @@ def test_unsupported_layout(layout: Layout, printer_class: type[Printer]) -> Non def test_method_arguments_none() -> None: - func = nodes.FunctionDef() - args = nodes.Arguments() + func = nodes.FunctionDef( + name="func", + lineno=1, + col_offset=0, + end_lineno=None, + end_col_offset=None, + parent=None, + ) + args = nodes.Arguments(vararg=None, kwarg=None, parent=func) args.args = None func.postinit(args, body=None) parsed_args = Printer._get_method_arguments(func) diff --git a/tests/pyreverse/test_printer_factory.py b/tests/pyreverse/test_printer_factory.py index 76406f0a8..23055be28 100644 --- a/tests/pyreverse/test_printer_factory.py +++ b/tests/pyreverse/test_printer_factory.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unit tests for pylint.pyreverse.printer_factory.""" @@ -12,13 +12,11 @@ from pylint.pyreverse import printer_factory from pylint.pyreverse.dot_printer import DotPrinter from pylint.pyreverse.plantuml_printer import PlantUmlPrinter from pylint.pyreverse.printer import Printer -from pylint.pyreverse.vcg_printer import VCGPrinter @pytest.mark.parametrize( "filetype, expected_printer_class", [ - ("vcg", VCGPrinter), ("dot", DotPrinter), ("puml", PlantUmlPrinter), ("plantuml", PlantUmlPrinter), diff --git a/tests/pyreverse/test_pyreverse_functional.py b/tests/pyreverse/test_pyreverse_functional.py index aab500b81..715ad3dad 100644 --- a/tests/pyreverse/test_pyreverse_functional.py +++ b/tests/pyreverse/test_pyreverse_functional.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import os from pathlib import Path diff --git a/tests/pyreverse/test_utils.py b/tests/pyreverse/test_utils.py index d64bf4fa7..ef843fd29 100644 --- a/tests/pyreverse/test_utils.py +++ b/tests/pyreverse/test_utils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Tests for pylint.pyreverse.utils.""" diff --git a/tests/pyreverse/test_writer.py b/tests/pyreverse/test_writer.py index 0bf92d918..ed0f5b31e 100644 --- a/tests/pyreverse/test_writer.py +++ b/tests/pyreverse/test_writer.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Unit test for ``DiagramWriter``.""" @@ -10,9 +10,11 @@ import codecs import os from collections.abc import Iterator from difflib import unified_diff +from pathlib import Path from unittest.mock import Mock import pytest +from pytest import MonkeyPatch from pylint.pyreverse.diadefslib import DefaultDiadefGenerator, DiadefsHandler from pylint.pyreverse.inspector import Linker, Project @@ -32,19 +34,21 @@ _DEFAULTS = { "all_associated": None, "mode": "PUB_ONLY", "show_builtin": False, + "show_stdlib": False, "only_classnames": False, "output_directory": "", + "no_standalone": False, } TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data") DOT_FILES = ["packages_No_Name.dot", "classes_No_Name.dot"] COLORIZED_DOT_FILES = ["packages_colorized.dot", "classes_colorized.dot"] -VCG_FILES = ["packages_No_Name.vcg", "classes_No_Name.vcg"] PUML_FILES = ["packages_No_Name.puml", "classes_No_Name.puml"] COLORIZED_PUML_FILES = ["packages_colorized.puml", "classes_colorized.puml"] MMD_FILES = ["packages_No_Name.mmd", "classes_No_Name.mmd"] HTML_FILES = ["packages_No_Name.html", "classes_No_Name.html"] +NO_STANDALONE_FILES = ["classes_no_standalone.dot", "packages_no_standalone.dot"] class Config: @@ -69,6 +73,11 @@ def _file_lines(path: str) -> list[str]: return [line for line in lines if line] +@pytest.fixture(autouse=True) +def change_to_temp_dir(monkeypatch: MonkeyPatch, tmp_path: Path) -> None: + monkeypatch.chdir(tmp_path) + + @pytest.fixture() def setup_dot( default_config: PyreverseConfig, get_project: GetProjectCallable @@ -88,12 +97,12 @@ def setup_colorized_dot( @pytest.fixture() -def setup_vcg( - vcg_config: PyreverseConfig, get_project: GetProjectCallable +def setup_no_standalone_dot( + no_standalone_dot_config: PyreverseConfig, get_project: GetProjectCallable ) -> Iterator[None]: - writer = DiagramWriter(vcg_config) - project = get_project(TEST_DATA_DIR) - yield from _setup(project, vcg_config, writer) + writer = DiagramWriter(no_standalone_dot_config) + project = get_project(TEST_DATA_DIR, name="no_standalone") + yield from _setup(project, no_standalone_dot_config, writer) @pytest.fixture() @@ -144,19 +153,6 @@ def _setup( diagram.extract_relationships() writer.write(dd) yield - for fname in ( - DOT_FILES - + COLORIZED_DOT_FILES - + VCG_FILES - + PUML_FILES - + COLORIZED_PUML_FILES - + MMD_FILES - + HTML_FILES - ): - try: - os.remove(fname) - except FileNotFoundError: - continue @pytest.mark.usefixtures("setup_dot") @@ -171,9 +167,9 @@ def test_colorized_dot_files(generated_file: str) -> None: _assert_files_are_equal(generated_file) -@pytest.mark.usefixtures("setup_vcg") -@pytest.mark.parametrize("generated_file", VCG_FILES) -def test_vcg_files(generated_file: str) -> None: +@pytest.mark.usefixtures("setup_no_standalone_dot") +@pytest.mark.parametrize("generated_file", NO_STANDALONE_FILES) +def test_no_standalone_dot_files(generated_file: str) -> None: _assert_files_are_equal(generated_file) @@ -238,5 +234,3 @@ def test_package_name_with_slash(default_config: PyreverseConfig) -> None: writer.write([obj]) assert os.path.exists("test_package_name_with_slash_.dot") - # remove the generated file - os.remove("test_package_name_with_slash_.dot") diff --git a/tests/regrtest_data/line_too_long_no_code.py b/tests/regrtest_data/line_too_long_no_code.py index 75ab07fc2..07fada40d 100644 --- a/tests/regrtest_data/line_too_long_no_code.py +++ b/tests/regrtest_data/line_too_long_no_code.py @@ -1,2 +1,2 @@ # ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 # pylint: disable=line-too-long -# See https://github.com/PyCQA/pylint/issues/3368 +# See https://github.com/pylint-dev/pylint/issues/3368 diff --git a/tests/regrtest_data/max_inferable_limit_for_classes/main.py b/tests/regrtest_data/max_inferable_limit_for_classes/main.py index 2588d916f..5f64c2e57 100644 --- a/tests/regrtest_data/max_inferable_limit_for_classes/main.py +++ b/tests/regrtest_data/max_inferable_limit_for_classes/main.py @@ -1,6 +1,6 @@ """This example is based on sqlalchemy. -See https://github.com/PyCQA/pylint/issues/5679 +See https://github.com/pylint-dev/pylint/issues/5679 """ from other_funcs import FromClause diff --git a/tests/reporters/unittest_json_reporter.py b/tests/reporters/unittest_json_reporter.py index 9104016ea..0182ebd1a 100644 --- a/tests/reporters/unittest_json_reporter.py +++ b/tests/reporters/unittest_json_reporter.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test for the JSON reporter.""" diff --git a/tests/reporters/unittest_reporting.py b/tests/reporters/unittest_reporting.py index 40a18036a..98cd17923 100644 --- a/tests/reporters/unittest_reporting.py +++ b/tests/reporters/unittest_reporting.py @@ -1,12 +1,11 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name from __future__ import annotations -import sys import warnings from contextlib import redirect_stdout from io import StringIO @@ -15,7 +14,6 @@ from pathlib import Path from typing import TYPE_CHECKING, TextIO import pytest -from _pytest.recwarn import WarningsRecorder from pylint import checkers from pylint.interfaces import HIGH @@ -128,16 +126,6 @@ def test_template_option_with_header(linter: PyLinter) -> None: assert out_lines[2] == '{ "Category": "convention" }' -def test_deprecation_set_output(recwarn: WarningsRecorder) -> None: - """TODO remove in 3.0.""" - reporter = BaseReporter() - # noinspection PyDeprecation - reporter.set_output(sys.stdout) - warning = recwarn.pop() - assert "set_output' will be removed in 3.0" in str(warning) - assert reporter.out == sys.stdout - - def test_parseable_output_deprecated() -> None: with warnings.catch_warnings(record=True) as cm: warnings.simplefilter("always") diff --git a/tests/test_check_parallel.py b/tests/test_check_parallel.py index 9134d485b..24f958406 100644 --- a/tests/test_check_parallel.py +++ b/tests/test_check_parallel.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Puts the check_parallel system under test.""" @@ -188,7 +188,7 @@ class TestCheckParallelFramework: See: https://stackoverflow.com/questions/8804830/python-multiprocessing-picklingerror-cant-pickle-type-function - https://github.com/PyCQA/pylint/pull/5584 + https://github.com/pylint-dev/pylint/pull/5584 """ linter = PyLinter(reporter=Reporter()) linter.attribute = argparse.ArgumentParser() # type: ignore[attr-defined] @@ -548,7 +548,7 @@ class TestCheckParallel: The intent here is to validate the reduce step: no stats should be lost. - Checks regression of https://github.com/PyCQA/pylint/issues/4118 + Checks regression of https://github.com/pylint-dev/pylint/issues/4118 """ # define the stats we expect to get back from the runs, these should only vary diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py deleted file mode 100644 index ed57c7306..000000000 --- a/tests/test_deprecation.py +++ /dev/null @@ -1,122 +0,0 @@ -# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt - -"""Check deprecation across the codebase.""" - -from __future__ import annotations - -from typing import Any - -import pytest -from astroid import nodes - -from pylint import lint -from pylint.checkers import BaseChecker -from pylint.checkers.mapreduce_checker import MapReduceMixin -from pylint.config import load_results, save_results -from pylint.interfaces import ( - IAstroidChecker, - IChecker, - Interface, - IRawChecker, - IReporter, - ITokenChecker, -) -from pylint.lint import PyLinter -from pylint.message import MessageDefinitionStore -from pylint.reporters import BaseReporter -from pylint.reporters.ureports.nodes import Section -from pylint.utils import FileState - - -def test_mapreducemixin() -> None: - """Test that MapReduceMixin has been deprecated correctly.""" - - class MyChecker(MapReduceMixin): - def get_map_data(self) -> Any: - ... - - def reduce_map_data(self, linter: PyLinter, data: list[Any]) -> None: - ... - - with pytest.warns(DeprecationWarning): - MyChecker() - - -def test_reporter_implements() -> None: - """Test that __implements__ on BaseReporter has been deprecated correctly.""" - - class MyReporter(BaseReporter): - __implements__ = IReporter - - def _display(self, layout: Section) -> None: - ... - - with pytest.warns(DeprecationWarning): - MyReporter() - - -def test_checker_implements() -> None: - """Test that __implements__ on BaseChecker has been deprecated correctly.""" - - class MyChecker(BaseChecker): - __implements__ = IAstroidChecker - - with pytest.warns(DeprecationWarning): - MyChecker(PyLinter()) - - -def test_interfaces() -> None: - """Test that all interfaces have been deprecated correctly.""" - with pytest.warns(DeprecationWarning): - Interface() - with pytest.warns(DeprecationWarning): - IAstroidChecker() - with pytest.warns(DeprecationWarning): - IReporter() - with pytest.warns(DeprecationWarning): - IRawChecker() - with pytest.warns(DeprecationWarning): - IChecker() - with pytest.warns(DeprecationWarning): - ITokenChecker() - - -def test_load_and_save_results() -> None: - """Test that load_results and save_results are deprecated.""" - with pytest.warns(DeprecationWarning): - save_results(object(), "") # type: ignore[arg-type] - with pytest.warns(DeprecationWarning): - load_results("") - - -def test_filestate() -> None: - """Test that FileState needs its arguments.""" - with pytest.warns(DeprecationWarning): - FileState() - with pytest.warns(DeprecationWarning): - FileState("foo") - with pytest.warns(DeprecationWarning): - FileState(msg_store=MessageDefinitionStore()) - FileState("foo", MessageDefinitionStore()) - - -def test_collectblocklines() -> None: - """Test FileState.collect_block_lines.""" - state = FileState("foo", MessageDefinitionStore()) - with pytest.warns(DeprecationWarning): - state.collect_block_lines(MessageDefinitionStore(), nodes.Module("foo")) - - -def test_patch_sys_path() -> None: - """Test that _patch_sys_path() is deprecated""" - with pytest.deprecated_call(): - lint._patch_sys_path([]) - - -def test_fix_import_path() -> None: - """Test that fix_import_path() is deprecated""" - with pytest.deprecated_call(): - with lint.fix_import_path([]): - pass diff --git a/tests/test_epylint.py b/tests/test_epylint.py deleted file mode 100644 index 7e9116e99..000000000 --- a/tests/test_epylint.py +++ /dev/null @@ -1,68 +0,0 @@ -# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt - -"""Test for issue https://github.com/PyCQA/pylint/issues/4286.""" -# pylint: disable=redefined-outer-name -from pathlib import PosixPath - -import pytest - -from pylint import epylint as lint - - -@pytest.fixture() -def example_path(tmp_path: PosixPath) -> PosixPath: - content = """class IvrAudioApp: - - def run(self): - self.hassan() - """ - path = tmp_path / "my_app.py" - with open(path, "w", encoding="utf-8") as f: - f.write(content) - return path - - -def test_epylint_good_command(example_path: PosixPath) -> None: - with pytest.warns(DeprecationWarning): - out, _ = lint.py_run( - f"{example_path} -E --disable=E1111 --msg-template " - "'{category} {module} {obj} {line} {column} {msg}'", - return_std=True, - ) - msg = out.read() - assert ( - msg - == """\ -************* Module my_app - error my_app IvrAudioApp.run 4 8 Instance of 'IvrAudioApp' has no 'hassan' member - """ - ) - - -def test_epylint_strange_command(example_path: PosixPath) -> None: - with pytest.warns(DeprecationWarning): - out, _ = lint.py_run( - # pylint: disable-next=consider-using-f-string - "%s -E --disable=E1111 --msg-template={category} {module} {obj} {line} {column} {msg}" - % example_path, - return_std=True, - ) - assert ( - out.read() - == """\ -************* Module {module} - fatal - ************* Module {obj} - fatal - ************* Module {line} - fatal - ************* Module {column} - fatal - ************* Module {msg} - fatal - ************* Module my_app - error - """ - ) diff --git a/tests/test_func.py b/tests/test_func.py index be0160ea0..d74e7ac6f 100644 --- a/tests/test_func.py +++ b/tests/test_func.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Functional/non regression tests for pylint.""" @@ -72,7 +72,7 @@ class LintTestUsingModule: try: self.linter.check(tocheck) except Exception as ex: - print(f"Exception: {ex} in {tocheck}:: {'‚ '.join(ex.args)}") + print(f"Exception: {ex} in {tocheck}:: {', '.join(ex.args)}") # This is legacy code we're trying to remove, not worth it to type correctly ex.file = tocheck # type: ignore[attr-defined] print(ex) @@ -115,7 +115,7 @@ def gen_tests( is_to_run = re.compile(filter_rgx).search else: is_to_run = ( # noqa: E731, We're going to throw all this anyway - lambda x: 1 # type: ignore[assignment,misc] # pylint: disable=unnecessary-lambda-assignment + lambda x: 1 # type: ignore[assignment] # pylint: disable=unnecessary-lambda-assignment ) tests: list[tuple[str, str, list[tuple[str, str]]]] = [] for module_file, messages_file in _get_tests_info(INPUT_DIR, MSG_DIR, "func_", ""): diff --git a/tests/test_functional.py b/tests/test_functional.py index 77cdbc58f..13bb060b7 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Functional full-module tests for PyLint.""" diff --git a/tests/test_functional_directories.py b/tests/test_functional_directories.py index f75772332..59a2eddfb 100644 --- a/tests/test_functional_directories.py +++ b/tests/test_functional_directories.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test that the directory structure of the functional tests is correct.""" from pathlib import Path diff --git a/tests/test_import_graph.py b/tests/test_import_graph.py index 2ad51f889..20cbdff00 100644 --- a/tests/test_import_graph.py +++ b/tests/test_import_graph.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name diff --git a/tests/test_numversion.py b/tests/test_numversion.py index 2c34c1aa3..d19c6a31e 100644 --- a/tests/test_numversion.py +++ b/tests/test_numversion.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/test_pragma_parser.py b/tests/test_pragma_parser.py index 3590950f4..b686c0042 100644 --- a/tests/test_pragma_parser.py +++ b/tests/test_pragma_parser.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import pytest diff --git a/tests/test_pylint_runners.py b/tests/test_pylint_runners.py index 6a55db9eb..f3baee24b 100644 --- a/tests/test_pylint_runners.py +++ b/tests/test_pylint_runners.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=missing-module-docstring, missing-function-docstring from __future__ import annotations @@ -12,21 +12,16 @@ import shlex import sys from collections.abc import Sequence from io import BufferedReader -from typing import Any, NoReturn +from typing import Any, NoReturn, Protocol from unittest.mock import MagicMock, mock_open, patch import pytest -from pylint import run_epylint, run_pylint, run_pyreverse, run_symilar +from pylint import run_pylint, run_pyreverse, run_symilar from pylint.testutils import GenericTestReporter as Reporter from pylint.testutils._run import _Run as Run from pylint.testutils.utils import _test_cwd -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: @@ -44,17 +39,6 @@ def test_runner(runner: _RunCallable, tmp_path: pathlib.Path) -> None: assert err.value.code == 0 -def test_epylint(tmp_path: pathlib.Path) -> None: - """TODO: 3.0 delete with epylint.""" - filepath = os.path.abspath(__file__) - with _test_cwd(tmp_path): - with patch.object(sys, "argv", ["", filepath]): - with pytest.raises(SystemExit) as err: - with pytest.warns(DeprecationWarning): - run_epylint() - assert err.value.code == 0 - - @pytest.mark.parametrize("runner", [run_pylint, run_pyreverse, run_symilar]) def test_runner_with_arguments(runner: _RunCallable, tmp_path: pathlib.Path) -> None: """Check the runners with arguments as parameter instead of sys.argv.""" @@ -66,25 +50,14 @@ def test_runner_with_arguments(runner: _RunCallable, tmp_path: pathlib.Path) -> assert err.value.code == 0 -def test_epylint_with_arguments(tmp_path: pathlib.Path) -> None: - """TODO: 3.0 delete with epylint.""" - filepath = os.path.abspath(__file__) - testargs = [filepath] - with _test_cwd(tmp_path): - with pytest.raises(SystemExit) as err: - with pytest.warns(DeprecationWarning): - run_epylint(testargs) - assert err.value.code == 0 - - def test_pylint_argument_deduplication( tmp_path: pathlib.Path, tests_directory: pathlib.Path ) -> None: """Check that the Pylint runner does not over-report on duplicate arguments. - See https://github.com/PyCQA/pylint/issues/6242 and - https://github.com/PyCQA/pylint/issues/4053 + See https://github.com/pylint-dev/pylint/issues/6242 and + https://github.com/pylint-dev/pylint/issues/4053 """ filepath = str(tests_directory / "functional/t/too/too_many_branches.py") testargs = shlex.split("--report n --score n --max-branches 13") diff --git a/tests/test_regr.py b/tests/test_regr.py index eb8ad6c5d..d92742943 100644 --- a/tests/test_regr.py +++ b/tests/test_regr.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Non regression tests for pylint, which requires a too specific configuration to be incorporated in the automatic functional test framework @@ -16,7 +16,6 @@ from collections.abc import Callable, Iterator from os.path import abspath, dirname, join from typing import cast -import astroid import pytest from pylint import testutils @@ -122,28 +121,6 @@ def test_check_package___init__(finalize_linter: PyLinter) -> None: assert checked == ["__init__"] -# TODO: 3.0: Test are broken because of property shenanigans of config attribute -# Re-enable after some of the old attributes have been removed after deprecation period -@pytest.mark.xfail -def test_pylint_config_attr() -> None: - mod = astroid.MANAGER.ast_from_module_name("pylint.lint.pylinter") - pylinter = mod["PyLinter"] - expect = [ - "_ArgumentsManager", - "object", - "ReportsHandlerMixIn", - "BaseTokenChecker", - "BaseChecker", - "_ArgumentsProvider", - ] - assert [c.name for c in pylinter.ancestors()] == expect - assert list(astroid.Instance(pylinter).getattr("config")) - inferred = list(astroid.Instance(pylinter).igetattr("config")) - assert len(inferred) >= 1 - assert inferred[0].root().name == "argparse" - assert inferred[0].name == "Namespace" - - @pytest.mark.timeout(30) @pytest.mark.parametrize("file_names", ([join(REGR_DATA, "hang", "pkg4972.string")],)) def test_hang(finalize_linter: PyLinter, file_names: list[str]) -> None: diff --git a/tests/test_self.py b/tests/test_self.py index e40dd7a4d..48f914e35 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=too-many-public-methods @@ -10,7 +10,6 @@ import configparser import contextlib import json import os -import platform import re import subprocess import sys @@ -133,7 +132,7 @@ class TestRunTC: @staticmethod def _run_pylint(args: list[str], out: TextIO, reporter: Any = None) -> int: - args = _add_rcfile_default_pylintrc(args + ["--persistent=no"]) + args = _add_rcfile_default_pylintrc([*args, "--persistent=no"]) with _patch_streams(out): with pytest.raises(SystemExit) as cm: with warnings.catch_warnings(): @@ -257,9 +256,9 @@ class TestRunTC: expected = textwrap.dedent( f""" ************* Module data.clientmodule_test - {module}:10:8: W0612: Unused variable 'local_variable' (unused-variable) - {module}:18:4: C0116: Missing function or method docstring (missing-function-docstring) - {module}:22:0: C0115: Missing class docstring (missing-class-docstring) + {module}:9:8: W0612: Unused variable 'local_variable' (unused-variable) + {module}:17:4: C0116: Missing function or method docstring (missing-function-docstring) + {module}:21:0: C0115: Missing class docstring (missing-class-docstring) """ ) self._test_output( @@ -301,7 +300,7 @@ class TestRunTC: An import inside `module_a`, which is used as a type annotation in `module_a`, should not prevent emitting the `unused-import` message when the same import occurs in `module_b` & is unused. - See: https://github.com/PyCQA/pylint/issues/4150 + See: https://github.com/pylint-dev/pylint/issues/4150 """ module1 = join( HERE, "regrtest_data", "imported_module_in_typehint", "module_a.py" @@ -349,16 +348,9 @@ class TestRunTC: assert isinstance(output, list) assert len(output) == 1 assert isinstance(output[0], dict) - # So each version wants a different column number... - if platform.python_implementation() == "PyPy": - column = 9 - elif sys.version_info >= (3, 8): - column = 9 - else: - column = 15 expected = { "obj": "", - "column": column, + "column": 9, "line": 1, "type": "error", "symbol": "syntax-error", @@ -775,7 +767,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er ) def test_fail_on_edge_case(self, opts: list[str], out: int) -> None: self._runtest( - opts + [join(HERE, "regrtest_data", "fail_under_plus7_5.py")], + [*opts, join(HERE, "regrtest_data", "fail_under_plus7_5.py")], code=out, ) @@ -888,7 +880,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er [ ["--disable=import-error,unused-import"], # Test with multiple jobs for 'hmac.py' for which we have a - # CVE against: https://github.com/PyCQA/pylint/issues/959 + # CVE against: https://github.com/pylint-dev/pylint/issues/959 ["-j2", "--disable=import-error,unused-import"], ], ) @@ -898,13 +890,13 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er for path in ("astroid.py", "hmac.py"): file_path = tmp_path / path file_path.write_text("'Docstring'\nimport completely_unknown\n") - pylint_call = [sys.executable, "-m", "pylint"] + args + [path] + pylint_call = [sys.executable, "-m", "pylint", *args, path] with _test_cwd(tmp_path): subprocess.check_output(pylint_call, cwd=str(tmp_path)) new_python_path = os.environ.get("PYTHONPATH", "").strip(":") with _test_cwd(tmp_path), _test_environ_pythonpath(f"{new_python_path}:"): # Appending a colon to PYTHONPATH should not break path stripping - # https://github.com/PyCQA/pylint/issues/3636 + # https://github.com/pylint-dev/pylint/issues/3636 subprocess.check_output(pylint_call, cwd=str(tmp_path)) @staticmethod @@ -983,7 +975,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er def test_regression_parallel_mode_without_filepath(self) -> None: # Test that parallel mode properly passes filepath - # https://github.com/PyCQA/pylint/issues/3564 + # https://github.com/pylint-dev/pylint/issues/3564 path = join( HERE, "regrtest_data", "regression_missing_init_3564", "subdirectory/" ) @@ -1022,7 +1014,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er path = join(HERE, "regrtest_data", "fail_on.py") # We set fail-under to be something very low so that even with the warnings # and errors that are generated they don't affect the exit code. - self._runtest([path, "--fail-under=-10", "--disable=C"] + args, code=expected) + self._runtest([path, "--fail-under=-10", "--disable=C", *args], code=expected) def test_one_module_fatal_error(self) -> None: """Fatal errors in one of several modules linted still exits non-zero.""" @@ -1046,7 +1038,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er ) def test_fail_on_info_only_exit_code(self, args: list[str], expected: int) -> None: path = join(HERE, "regrtest_data", "fail_on_info_only.py") - self._runtest([path] + args, code=expected) + self._runtest([path, *args], code=expected) @pytest.mark.parametrize( "output_format, expected_output", @@ -1127,7 +1119,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er def test_regex_paths_csv_validator() -> None: """Test to see if _regexp_paths_csv_validator works. Previously the validator crashed when encountering already validated values. - Reported in https://github.com/PyCQA/pylint/issues/5437 + Reported in https://github.com/pylint-dev/pylint/issues/5437 """ with pytest.raises(SystemExit) as ex: args = _add_rcfile_default_pylintrc( @@ -1138,7 +1130,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er @staticmethod def test_max_inferred_for_complicated_class_hierarchy() -> None: - """Regression test for a crash reported in https://github.com/PyCQA/pylint/issues/5679. + """Regression test for a crash reported in https://github.com/pylint-dev/pylint/issues/5679. The class hierarchy of 'sqlalchemy' is so intricate that it becomes uninferable with the standard max_inferred of 100. We used to crash when this happened. @@ -1273,7 +1265,7 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er def test_line_too_long_useless_suppression(self) -> None: """A test that demonstrates a known false positive for useless-suppression - See https://github.com/PyCQA/pylint/issues/3368 + See https://github.com/pylint-dev/pylint/issues/3368 If you manage to make this test fail and remove the useless-suppression warning please contact open a Pylint PR! @@ -1332,7 +1324,7 @@ class TestCallbackOptions: """Test whether certain strings are in the output of a callback command.""" command = _add_rcfile_default_pylintrc(command) process = subprocess.run( - [sys.executable, "-m", "pylint"] + command, + [sys.executable, "-m", "pylint", *command], capture_output=True, encoding="utf-8", check=False, @@ -1356,7 +1348,7 @@ class TestCallbackOptions: """Test the --help-msg flag.""" args = _add_rcfile_default_pylintrc(args) process = subprocess.run( - [sys.executable, "-m", "pylint"] + args, + [sys.executable, "-m", "pylint", *args], capture_output=True, encoding="utf-8", check=False, @@ -1373,7 +1365,7 @@ class TestCallbackOptions: """Test the --generate-rcfile flag.""" args = _add_rcfile_default_pylintrc(["--generate-rcfile"]) process = subprocess.run( - [sys.executable, "-m", "pylint"] + args, + [sys.executable, "-m", "pylint", *args], capture_output=True, encoding="utf-8", check=False, @@ -1384,7 +1376,7 @@ class TestCallbackOptions: assert "profile" not in process.stdout args = _add_rcfile_default_pylintrc(["--generate-rcfile"]) process_two = subprocess.run( - [sys.executable, "-m", "pylint"] + args, + [sys.executable, "-m", "pylint", *args], capture_output=True, encoding="utf-8", check=False, @@ -1436,7 +1428,7 @@ class TestCallbackOptions: ] ) process = subprocess.run( - [sys.executable, "-m", "pylint"] + args, + [sys.executable, "-m", "pylint", *args], capture_output=True, encoding="utf-8", check=False, @@ -1449,7 +1441,7 @@ class TestCallbackOptions: assert 'preferred-modules = ["a:b"]' in process.stdout process_two = subprocess.run( - [sys.executable, "-m", "pylint"] + args, + [sys.executable, "-m", "pylint", *args], capture_output=True, encoding="utf-8", check=False, diff --git a/tests/test_similar.py b/tests/test_similar.py index 051bc4b27..0f2ec242c 100644 --- a/tests/test_similar.py +++ b/tests/test_similar.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/testutils/_primer/fixtures/message_changed/expected.txt b/tests/testutils/_primer/fixtures/message_changed/expected.txt index 9640bed9e..676946fd2 100644 --- a/tests/testutils/_primer/fixtures/message_changed/expected.txt +++ b/tests/testutils/_primer/fixtures/message_changed/expected.txt @@ -2,14 +2,14 @@ -**Effect on [astroid](https://github.com/PyCQA/astroid):** +**Effect on [astroid](https://github.com/pylint-dev/astroid):** The following messages are now emitted: <details> 1) locally-disabled: *Locally disabling redefined-builtin [we added some text in the message] (W0622)* -https://github.com/PyCQA/astroid/blob/123456789abcdef/astroid/__init__.py#L91 +https://github.com/pylint-dev/astroid/blob/123456789abcdef/astroid/__init__.py#L91 </details> @@ -19,7 +19,7 @@ The following messages are no longer emitted: 1) locally-disabled: *Locally disabling redefined-builtin (W0622)* -https://github.com/PyCQA/astroid/blob/123456789abcdef/astroid/__init__.py#L91 +https://github.com/pylint-dev/astroid/blob/123456789abcdef/astroid/__init__.py#L91 </details> diff --git a/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt b/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt index 3912ea15b..3882b658f 100644 --- a/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt +++ b/tests/testutils/_primer/fixtures/message_changed/expected_truncated.txt @@ -2,18 +2,18 @@ -**Effect on [astroid](https://github.com/PyCQA/astroid):** +**Effect on [astroid](https://github.com/pylint-dev/astroid):** The following messages are now emitted: <details> 1) locally-disabled: *Locally disabling redefined-builtin [we added some text in the message] (W0622)* -https://github.com/PyCQA/astroid/blob/123456789abcdef/astroid/__init__.py#L91 +https://github.com/pylint-dev/astroid/blob/123456789abcdef/astroid/__init__.py#L91 </details> -The following message... +The followi... *This comment was truncated because GitHub allows only 525 characters in a comment.* diff --git a/tests/testutils/_primer/fixtures/message_changed/main.json b/tests/testutils/_primer/fixtures/message_changed/main.json index 96f0aaaef..69a42be1d 100644 --- a/tests/testutils/_primer/fixtures/message_changed/main.json +++ b/tests/testutils/_primer/fixtures/message_changed/main.json @@ -10,7 +10,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "locally-disabled", "message": "Locally disabling redefined-builtin (W0622)", "message-id": "I0011" @@ -23,7 +23,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "unknown-option-value", "message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'", "message-id": "W0012" diff --git a/tests/testutils/_primer/fixtures/message_changed/pr.json b/tests/testutils/_primer/fixtures/message_changed/pr.json index 9e2eda37b..ef7e20fba 100644 --- a/tests/testutils/_primer/fixtures/message_changed/pr.json +++ b/tests/testutils/_primer/fixtures/message_changed/pr.json @@ -10,7 +10,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "locally-disabled", "message": "Locally disabling redefined-builtin [we added some text in the message] (W0622)", "message-id": "I0011" @@ -23,7 +23,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "unknown-option-value", "message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'", "message-id": "W0012" diff --git a/tests/testutils/_primer/fixtures/no_change/main.json b/tests/testutils/_primer/fixtures/no_change/main.json index cd361e618..c2f34c750 100644 --- a/tests/testutils/_primer/fixtures/no_change/main.json +++ b/tests/testutils/_primer/fixtures/no_change/main.json @@ -10,7 +10,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "locally-disabled", "message": "Locally disabling redefined-builtin (W0622)", "message-id": "I0011" @@ -23,7 +23,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "unknown-option-value", "message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'", "message-id": "W0012" diff --git a/tests/testutils/_primer/fixtures/no_change/pr.json b/tests/testutils/_primer/fixtures/no_change/pr.json index 96f0aaaef..69a42be1d 100644 --- a/tests/testutils/_primer/fixtures/no_change/pr.json +++ b/tests/testutils/_primer/fixtures/no_change/pr.json @@ -10,7 +10,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "locally-disabled", "message": "Locally disabling redefined-builtin (W0622)", "message-id": "I0011" @@ -23,7 +23,7 @@ "column": 0, "endLine": null, "endColumn": null, - "path": "tests/.pylint_primer_tests/PyCQA/astroid/astroid/__init__.py", + "path": "tests/.pylint_primer_tests/pylint-dev/astroid/astroid/__init__.py", "symbol": "unknown-option-value", "message": "Unknown option value for 'disable', expected a valid pylint message and got 'Ellipsis'", "message-id": "W0012" diff --git a/tests/testutils/_primer/test_package_to_lint.py b/tests/testutils/_primer/test_package_to_lint.py index 220e2c0b2..19645d1eb 100644 --- a/tests/testutils/_primer/test_package_to_lint.py +++ b/tests/testutils/_primer/test_package_to_lint.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pylint.testutils._primer import PRIMER_DIRECTORY_PATH, PackageToLint @@ -31,7 +31,8 @@ def test_package_to_lint() -> None: expected_args = [ str(expected_path_to_lint), f"--rcfile={expected_pylintrc_path}", - ] + args + *args, + ] assert package_to_lint.pylint_args == expected_args diff --git a/tests/testutils/_primer/test_primer.py b/tests/testutils/_primer/test_primer.py index d57e98d21..076c58a14 100644 --- a/tests/testutils/_primer/test_primer.py +++ b/tests/testutils/_primer/test_primer.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Test the primer commands. """ from __future__ import annotations @@ -29,7 +29,7 @@ DEFAULT_ARGS = ["python tests/primer/__main__.py", "compare", "--commit=v2.14.2" @pytest.mark.parametrize("args", [[], ["wrong_command"]]) def test_primer_launch_bad_args(args: list[str], capsys: CaptureFixture) -> None: with pytest.raises(SystemExit): - with patch("sys.argv", ["python tests/primer/__main__.py"] + args): + with patch("sys.argv", ["python tests/primer/__main__.py", *args]): Primer(PRIMER_DIRECTORY, PACKAGES_TO_PRIME_PATH).run() out, err = capsys.readouterr() assert not out @@ -84,7 +84,7 @@ class TestPrimer: pr = directory / "pr.json" if expected_file is None: expected_file = directory / "expected.txt" - new_argv = DEFAULT_ARGS + [f"--base-file={main}", f"--new-file={pr}"] + new_argv = [*DEFAULT_ARGS, f"--base-file={main}", f"--new-file={pr}"] with patch("sys.argv", new_argv): Primer(PRIMER_DIRECTORY, PACKAGES_TO_PRIME_PATH).run() with open(PRIMER_DIRECTORY / "comment.txt", encoding="utf8") as f: diff --git a/tests/testutils/data/functional/broken_output_ok_test/exec_used.py b/tests/testutils/data/functional/broken_output_ok_test/exec_used.py new file mode 100644 index 000000000..73d629d95 --- /dev/null +++ b/tests/testutils/data/functional/broken_output_ok_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that is broken +- the functional test itself is right + +So it should be updated. +""" +exec('a = 42') # [exec-used] diff --git a/tests/testutils/data/functional/broken_output_ok_test/exec_used.txt b/tests/testutils/data/functional/broken_output_ok_test/exec_used.txt new file mode 100644 index 000000000..d74b20893 --- /dev/null +++ b/tests/testutils/data/functional/broken_output_ok_test/exec_used.txt @@ -0,0 +1 @@ +exec-used:UNDEFINED diff --git a/tests/testutils/data/functional/broken_output_wrong_test/exec_used.py b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.py new file mode 100644 index 000000000..8b6c06a57 --- /dev/null +++ b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that is broken +- the functional test itself is wrong + +So it cannot be updated. +""" +exec('a = 42') diff --git a/tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt new file mode 100644 index 000000000..d74b20893 --- /dev/null +++ b/tests/testutils/data/functional/broken_output_wrong_test/exec_used.txt @@ -0,0 +1 @@ +exec-used:UNDEFINED diff --git a/tests/testutils/data/functional/no_output_ok_test/exec_used.py b/tests/testutils/data/functional/no_output_ok_test/exec_used.py new file mode 100644 index 000000000..59d19fec0 --- /dev/null +++ b/tests/testutils/data/functional/no_output_ok_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that does not exist +- the functional test itself is right + +So it should be created +""" +exec('a = 42') # [exec-used] diff --git a/tests/testutils/data/functional/no_output_wrong_test/exec_used.py b/tests/testutils/data/functional/no_output_wrong_test/exec_used.py new file mode 100644 index 000000000..d3b318ab7 --- /dev/null +++ b/tests/testutils/data/functional/no_output_wrong_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that does not exist +- the functional test itself is wrong + +So it cannot be created. +""" +exec('a = 42') diff --git a/tests/testutils/data/functional/ok_output_ok_test/exec_used.py b/tests/testutils/data/functional/ok_output_ok_test/exec_used.py new file mode 100644 index 000000000..049213dd4 --- /dev/null +++ b/tests/testutils/data/functional/ok_output_ok_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that is right +- the functional test itself is right + +Nothing should be done. +""" +exec('a = 42') # [exec-used] diff --git a/tests/testutils/data/functional/ok_output_ok_test/exec_used.txt b/tests/testutils/data/functional/ok_output_ok_test/exec_used.txt new file mode 100644 index 000000000..6d0f82baf --- /dev/null +++ b/tests/testutils/data/functional/ok_output_ok_test/exec_used.txt @@ -0,0 +1 @@ +exec-used:7:0:7:14::Use of exec:UNDEFINED diff --git a/tests/testutils/data/functional/ok_output_wrong_test/exec_used.py b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.py new file mode 100644 index 000000000..3f8637228 --- /dev/null +++ b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that is right +- the functional test itself is wrong + +Nothing should be done. +""" +exec('a = 42') diff --git a/tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt new file mode 100644 index 000000000..6d0f82baf --- /dev/null +++ b/tests/testutils/data/functional/ok_output_wrong_test/exec_used.txt @@ -0,0 +1 @@ +exec-used:7:0:7:14::Use of exec:UNDEFINED diff --git a/tests/testutils/data/functional/wrong_output_ok_test/exec_used.py b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.py new file mode 100644 index 000000000..0874f0a15 --- /dev/null +++ b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that is wrong (but not broken) +- the functional test itself is right + +So it needs to be updated. +""" +exec('a = 42') # [exec-used] diff --git a/tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt new file mode 100644 index 000000000..a737b8d51 --- /dev/null +++ b/tests/testutils/data/functional/wrong_output_ok_test/exec_used.txt @@ -0,0 +1 @@ +missing-docstring:5:0:1:1::Missing docstring in file:HIGH diff --git a/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py new file mode 100644 index 000000000..fc35114e8 --- /dev/null +++ b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.py @@ -0,0 +1,7 @@ +"""This is an example for a functional test with +- an output that is wrong (but not broken) +- the functional test itself is wrong + +So it can't be updated. +""" +exec('a = 42') diff --git a/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt new file mode 100644 index 000000000..a737b8d51 --- /dev/null +++ b/tests/testutils/data/functional/wrong_output_wrong_test/exec_used.txt @@ -0,0 +1 @@ +missing-docstring:5:0:1:1::Missing docstring in file:HIGH diff --git a/tests/testutils/data/m/max_overflow/max_overflow_1.py b/tests/testutils/data/m/max_overflow/max_overflow_1.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/testutils/data/m/max_overflow/max_overflow_1.py diff --git a/tests/testutils/data/m/max_overflow/max_overflow_2.py b/tests/testutils/data/m/max_overflow/max_overflow_2.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/testutils/data/m/max_overflow/max_overflow_2.py diff --git a/tests/testutils/data/m/max_overflow/max_overflow_3.py b/tests/testutils/data/m/max_overflow/max_overflow_3.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/testutils/data/m/max_overflow/max_overflow_3.py diff --git a/tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py b/tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/testutils/data/u/_no_issue_here/_incredibly_bold_mischief.py diff --git a/tests/testutils/dummy_checker.py b/tests/testutils/dummy_checker.py index e8a8ff79f..cfd18ddd3 100644 --- a/tests/testutils/dummy_checker.py +++ b/tests/testutils/dummy_checker.py @@ -1,3 +1,3 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt diff --git a/tests/testutils/test_configuration_test.py b/tests/testutils/test_configuration_test.py index 2efa65df3..fa6156a29 100644 --- a/tests/testutils/test_configuration_test.py +++ b/tests/testutils/test_configuration_test.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import logging from pathlib import Path diff --git a/tests/testutils/test_functional_testutils.py b/tests/testutils/test_functional_testutils.py index 68dad697d..d1047c8ee 100644 --- a/tests/testutils/test_functional_testutils.py +++ b/tests/testutils/test_functional_testutils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt """Tests for the functional test framework.""" @@ -41,8 +41,32 @@ def test_parsing_of_pylintrc_init_hook() -> None: def test_get_functional_test_files_from_directory() -> None: """Test that we correctly check the functional test directory structures.""" - with pytest.raises(AssertionError, match="using_dir.py should not go in"): - get_functional_test_files_from_directory(DATA_DIRECTORY) + with pytest.raises(AssertionError) as exc_info: + get_functional_test_files_from_directory(DATA_DIRECTORY / "u") + assert exc_info.match("'use_dir.py' should go in 'use'") + assert exc_info.match( + "using_dir.py should go in a directory that starts with the " + "first letters of 'using_dir'" + ) + assert "incredibly_bold_mischief.py" not in str(exc_info.value) + # Leading underscore mean that this should not fail the assertion + get_functional_test_files_from_directory(DATA_DIRECTORY / "u/_no_issue_here") + + +def test_get_functional_test_files_from_crowded_directory() -> None: + """Test that we correctly check the functional test directory structures.""" + with pytest.raises(AssertionError) as exc_info: + get_functional_test_files_from_directory( + DATA_DIRECTORY / "m", max_file_per_directory=1 + ) + assert exc_info.match("m: 4 when the max is 1") + assert exc_info.match("max_overflow: 3 when the max is 1") + with pytest.raises(AssertionError) as exc_info: + get_functional_test_files_from_directory( + DATA_DIRECTORY / "m", max_file_per_directory=3 + ) + assert exc_info.match("m: 4 when the max is 3") + assert "max_overflow" not in str(exc_info.value) def test_minimal_messages_config_enabled(pytest_config: MagicMock) -> None: diff --git a/tests/testutils/test_lint_module_output_update.py b/tests/testutils/test_lint_module_output_update.py index 2e387a118..a8bfc5fde 100644 --- a/tests/testutils/test_lint_module_output_update.py +++ b/tests/testutils/test_lint_module_output_update.py @@ -1,20 +1,24 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name from __future__ import annotations +import shutil from collections.abc import Callable from pathlib import Path import pytest -from pylint.constants import PY38_PLUS -from pylint.testutils import FunctionalTestFile +from pylint.constants import IS_PYPY, PY38_PLUS, PY39_PLUS +from pylint.testutils import FunctionalTestFile, LintModuleTest from pylint.testutils.functional import LintModuleOutputUpdate +FIXTURE_DIRECTORY = Path(__file__).parent / "data/functional" +DIRECTORIES = list(FIXTURE_DIRECTORY.iterdir()) + @pytest.fixture() def lint_module_fixture( @@ -76,4 +80,78 @@ def test_lint_module_output_update_remove_useless_txt( expected_output_file.write_text("", encoding="utf8") filename.write_text("", encoding="utf8") lmou.runTest() - assert not (expected_output_file).exists() + assert not expected_output_file.exists() + + +@pytest.mark.skipif( + not PY38_PLUS or (IS_PYPY and not PY39_PLUS), + reason="Requires accurate 'end_col' value to update output", +) +@pytest.mark.parametrize( + "directory_path", DIRECTORIES, ids=[str(p) for p in DIRECTORIES] +) +def test_update_of_functional_output(directory_path: Path, tmp_path: Path) -> None: + """Functional test for the functional tests' helper.""" + + def _check_expected_output(_ftf: FunctionalTestFile) -> None: + new_output_path = _ftf.expected_output + assert Path( + new_output_path + ).exists(), "The expected output file does not exists" + with open(new_output_path, encoding="utf8") as f: + new_output = f.read() + assert ( + new_output == "exec-used:7:0:7:14::Use of exec:UNDEFINED\n" + ), f"The content was wrongly updated in {new_output_path}" + + def _assert_behavior_is_correct( + _ftf: FunctionalTestFile, + _lint_module: LintModuleTest, + _lint_module_output_update: LintModuleOutputUpdate, + _new_path: Path, + ) -> None: + new_path_str = str(_new_path) + if "wrong_test" in new_path_str: + expected = r'Wrong message\(s\) raised for "exec_used.py"' + with pytest.raises(AssertionError, match=expected): + _lint_module.runTest() + # When the tests are wrong we do not update the output at all + # and the test should fail + with pytest.raises(AssertionError, match=expected): + _lint_module_output_update.runTest() + elif "ok_test" in new_path_str: + if any(f"{x}_output" in new_path_str for x in ("wrong", "no", "broken")): + with pytest.raises( + AssertionError, match='Wrong output for "exec_used.txt"' + ): + _lint_module.runTest() + elif "ok_output" in new_path_str: + _lint_module.runTest() + _check_expected_output(_ftf) + else: + raise AssertionError(f"Unhandled test case: {new_path_str}") + + # When the tests are ok we update the output whatever it's state + # was originally + _lint_module_output_update.runTest() + _check_expected_output(_ftf) + else: + raise AssertionError( + f"Do not pollute '{FIXTURE_DIRECTORY}' with unrelated " + f"or badly named test files." + ) + + new_path = tmp_path / directory_path.name + shutil.copytree(directory_path, new_path) + for filename in new_path.iterdir(): + if filename.suffix != ".py": + continue + ftf = FunctionalTestFile(directory=str(new_path), filename=filename.name) + # Standard functional test helper + lint_module = LintModuleTest(ftf) + # Functional test helper that automatically update the output + lint_module_output_update = LintModuleOutputUpdate(ftf) + + _assert_behavior_is_correct( + ftf, lint_module, lint_module_output_update, new_path + ) diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py index 5b2bf1a1b..8e9cf2800 100644 --- a/tests/testutils/test_output_line.py +++ b/tests/testutils/test_output_line.py @@ -1,12 +1,12 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt # pylint: disable=redefined-outer-name from __future__ import annotations -import sys +from typing import Protocol import pytest @@ -16,11 +16,6 @@ from pylint.message import Message from pylint.testutils.output_line import OutputLine from pylint.typing import MessageLocationTuple -if sys.version_info >= (3, 8): - from typing import Protocol -else: - from typing_extensions import Protocol - class _MessageCallable(Protocol): def __call__(self, confidence: Confidence = HIGH) -> Message: @@ -134,82 +129,11 @@ def test_output_line_to_csv(confidence: Confidence, message: _MessageCallable) - ) -def test_output_line_from_csv_error() -> None: - """Test that errors are correctly raised for incorrect OutputLine's.""" - # Test a csv-string which does not have a number for line and column - with pytest.warns( - UserWarning, - match="msg-symbolic-name:42:27:MyClass.my_function:The message", - ): - OutputLine.from_csv("'missing-docstring', 'line', 'column', 'obj', 'msg'", True) - # Test a tuple which does not have a number for line and column - with pytest.warns( - UserWarning, match="we got 'missing-docstring:line:column:obj:msg'" - ): - csv = ("missing-docstring", "line", "column", "obj", "msg") - OutputLine.from_csv(csv, True) - # Test a csv-string that is too long - with pytest.warns( - UserWarning, - match="msg-symbolic-name:42:27:MyClass.my_function:The message", - ): - OutputLine.from_csv( - "'missing-docstring', 1, 2, 'obj', 'msg', 'func', 'message', 'conf', 'too_long'", - True, - ) - - -@pytest.mark.parametrize( - "confidence,expected_confidence", [[None, "UNDEFINED"], ["INFERENCE", "INFERENCE"]] -) -def test_output_line_from_csv_deprecated( - confidence: str | None, expected_confidence: str -) -> None: - """Test that the OutputLine NamedTuple is instantiated correctly with from_csv. - Test OutputLine's of length 5 or 6. - """ - if confidence: - proper_csv = [ - "missing-docstring", - "1", - "2", - "obj", - "msg", - confidence, - ] - else: - proper_csv = ["missing-docstring", "1", "2", "obj", "msg"] - with pytest.warns(DeprecationWarning) as records: - output_line = OutputLine.from_csv(proper_csv, True) - assert len(records) == 1 - - expected_column = 2 if PY38_PLUS else 0 - assert output_line == OutputLine( - symbol="missing-docstring", - lineno=1, - column=expected_column, - end_lineno=None, - end_column=None, - object="obj", - msg="msg", - confidence=expected_confidence, - ) - - def test_output_line_from_csv() -> None: """Test that the OutputLine NamedTuple is instantiated correctly with from_csv. Test OutputLine of length 8. """ - proper_csv = [ - "missing-docstring", - "1", - "2", - "1", - "None", - "obj", - "msg", - "HIGH", - ] + proper_csv = ["missing-docstring", "1", "2", "1", "None", "obj", "msg", "HIGH"] expected_column = 2 if PY38_PLUS else 0 output_line = OutputLine.from_csv(proper_csv) diff --git a/tests/testutils/test_pyreverse_testutils.py b/tests/testutils/test_pyreverse_testutils.py index 95cbc239f..2bb411c4d 100644 --- a/tests/testutils/test_pyreverse_testutils.py +++ b/tests/testutils/test_pyreverse_testutils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from pathlib import Path diff --git a/tests/testutils/test_testutils_utils.py b/tests/testutils/test_testutils_utils.py index b521e25c4..f32f87ba3 100644 --- a/tests/testutils/test_testutils_utils.py +++ b/tests/testutils/test_testutils_utils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import os import sys diff --git a/tests/utils/unittest_ast_walker.py b/tests/utils/unittest_ast_walker.py index 5a2dc6609..2aac78126 100644 --- a/tests/utils/unittest_ast_walker.py +++ b/tests/utils/unittest_ast_walker.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt from __future__ import annotations diff --git a/tests/utils/unittest_utils.py b/tests/utils/unittest_utils.py index c802c40e2..d2cfbd5b2 100644 --- a/tests/utils/unittest_utils.py +++ b/tests/utils/unittest_utils.py @@ -1,6 +1,6 @@ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE -# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt +# For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE +# Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt import io |