Skip to content

Commit 93a1e01

Browse files
authored
Remove set_config_directly (#6123)
1 parent 3418e22 commit 93a1e01

File tree

4 files changed

+4
-51
lines changed

4 files changed

+4
-51
lines changed

ChangeLog

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Release date: TBA
4040

4141
* Fix bug where specifically enabling just ``await-outside-async`` was not possible.
4242

43+
* The ``set_config_directly`` decorator has been removed.
44+
4345
* Added new message called ``duplicate-value`` which identifies duplicate values inside sets.
4446

4547
Closes #5880

doc/whatsnew/2.14.rst

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Other Changes
4848

4949
* The concept of checker priority has been removed.
5050

51+
* The ``set_config_directly`` decorator has been removed.
52+
5153
* Fix false negative for ``no-member`` when attempting to assign an instance
5254
attribute to itself without any prior assignment.
5355

pylint/testutils/decorator.py

-36
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import functools
66
import optparse # pylint: disable=deprecated-module
7-
import warnings
87

98
from pylint.lint import PyLinter
109
from pylint.testutils.checker_test_case import CheckerTestCase
@@ -52,38 +51,3 @@ def _forward(self, *args, **test_function_kwargs):
5251
return _forward
5352

5453
return _wrapper
55-
56-
57-
def set_config_directly(**kwargs):
58-
"""Decorator for setting config values on a checker without validation.
59-
60-
Some options should be declared in two different checkers. This is
61-
impossible without duplicating the option key. For example:
62-
"no-docstring-rgx" in DocstringParameterChecker & DocStringChecker
63-
This decorator allows to directly set such options.
64-
65-
Passing the args and kwargs back to the test function itself
66-
allows this decorator to be used on parametrized test cases.
67-
"""
68-
# pylint: disable=fixme
69-
# TODO: Remove this function in 2.14
70-
warnings.warn(
71-
"The set_config_directly decorator will be removed in 2.14. To decorate "
72-
"unittests you can use set_config. If this causes a duplicate KeyError "
73-
"you can consider writing the tests using the functional test framework.",
74-
DeprecationWarning,
75-
)
76-
77-
def _wrapper(fun):
78-
@functools.wraps(fun)
79-
def _forward(self, *args, **test_function_kwargs):
80-
for key, value in kwargs.items():
81-
setattr(self.checker.config, key, value)
82-
if isinstance(self, CheckerTestCase):
83-
# reopen checker in case, it may be interested in configuration change
84-
self.checker.open()
85-
fun(self, *args, **test_function_kwargs)
86-
87-
return _forward
88-
89-
return _wrapper

tests/testutils/test_decorator.py

-15
This file was deleted.

0 commit comments

Comments
 (0)