diff --git a/ChangeLog b/ChangeLog index 8d3398fcf5..8a4b812c0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ Release date: TBA * Fix bug where specifically enabling just ``await-outside-async`` was not possible. +* The ``set_config_directly`` decorator has been removed. + * Added new message called ``duplicate-value`` which identifies duplicate values inside sets. Closes #5880 diff --git a/doc/whatsnew/2.14.rst b/doc/whatsnew/2.14.rst index 19e812d8cc..f17493b089 100644 --- a/doc/whatsnew/2.14.rst +++ b/doc/whatsnew/2.14.rst @@ -48,6 +48,8 @@ Other Changes * The concept of checker priority has been removed. +* The ``set_config_directly`` decorator has been removed. + * Fix false negative for ``no-member`` when attempting to assign an instance attribute to itself without any prior assignment. diff --git a/pylint/testutils/decorator.py b/pylint/testutils/decorator.py index b2a790c452..466a42d4f1 100644 --- a/pylint/testutils/decorator.py +++ b/pylint/testutils/decorator.py @@ -4,7 +4,6 @@ import functools import optparse # pylint: disable=deprecated-module -import warnings from pylint.lint import PyLinter from pylint.testutils.checker_test_case import CheckerTestCase @@ -52,38 +51,3 @@ def _forward(self, *args, **test_function_kwargs): return _forward return _wrapper - - -def set_config_directly(**kwargs): - """Decorator for setting config values on a checker without validation. - - Some options should be declared in two different checkers. This is - impossible without duplicating the option key. For example: - "no-docstring-rgx" in DocstringParameterChecker & DocStringChecker - This decorator allows to directly set such options. - - Passing the args and kwargs back to the test function itself - allows this decorator to be used on parametrized test cases. - """ - # pylint: disable=fixme - # TODO: Remove this function in 2.14 - warnings.warn( - "The set_config_directly decorator will be removed in 2.14. To decorate " - "unittests you can use set_config. If this causes a duplicate KeyError " - "you can consider writing the tests using the functional test framework.", - DeprecationWarning, - ) - - def _wrapper(fun): - @functools.wraps(fun) - def _forward(self, *args, **test_function_kwargs): - for key, value in kwargs.items(): - setattr(self.checker.config, key, value) - if isinstance(self, CheckerTestCase): - # reopen checker in case, it may be interested in configuration change - self.checker.open() - fun(self, *args, **test_function_kwargs) - - return _forward - - return _wrapper diff --git a/tests/testutils/test_decorator.py b/tests/testutils/test_decorator.py deleted file mode 100644 index 42b88ab5c9..0000000000 --- a/tests/testutils/test_decorator.py +++ /dev/null @@ -1,15 +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 - -import pytest - -from pylint.testutils.decorator import set_config_directly - - -def test_deprecation_of_set_config_directly() -> None: - """Test that the deprecation of set_config_directly works as expected.""" - - with pytest.warns(DeprecationWarning) as records: - set_config_directly() - assert len(records) == 1