|
4 | 4 |
|
5 | 5 | import functools
|
6 | 6 | import optparse # pylint: disable=deprecated-module
|
7 |
| -import warnings |
8 | 7 |
|
9 | 8 | from pylint.lint import PyLinter
|
10 | 9 | from pylint.testutils.checker_test_case import CheckerTestCase
|
@@ -52,38 +51,3 @@ def _forward(self, *args, **test_function_kwargs):
|
52 | 51 | return _forward
|
53 | 52 |
|
54 | 53 | 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 |
0 commit comments