File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import functools
5
5
import optparse # pylint: disable=deprecated-module
6
+ import warnings
6
7
7
8
from pylint .lint import PyLinter
8
9
from pylint .testutils .checker_test_case import CheckerTestCase
@@ -63,6 +64,14 @@ def set_config_directly(**kwargs):
63
64
Passing the args and kwargs back to the test function itself
64
65
allows this decorator to be used on parametrized test cases.
65
66
"""
67
+ # pylint: disable=fixme
68
+ # TODO: Remove this function in 2.14
69
+ warnings .warn (
70
+ "The set_config_directly decorator will be removed in 2.14. To decorate "
71
+ "unittests you can use set_config. If this causes a duplicate KeyError "
72
+ "you can consider writing the tests using the functional test framework." ,
73
+ DeprecationWarning ,
74
+ )
66
75
67
76
def _wrapper (fun ):
68
77
@functools .wraps (fun )
Original file line number Diff line number Diff line change
1
+ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2
+ # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
3
+
4
+
5
+ import pytest
6
+
7
+ from pylint .testutils .decorator import set_config_directly
8
+
9
+
10
+ def test_deprecation_of_set_config_directly () -> None :
11
+ """Test that the deprecation of set_config_directly works as expected"""
12
+
13
+ with pytest .warns (DeprecationWarning ) as records :
14
+ set_config_directly ()
15
+ assert len (records ) == 1
You can’t perform that action at this time.
0 commit comments