Skip to content

Commit acc4f3b

Browse files
Remove the optparse section from set_config (#6289)
Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent eb6814e commit acc4f3b

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

pylint/testutils/decorator.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
44

55
import functools
6-
import optparse # pylint: disable=deprecated-module
76

87
from pylint.config.utils import _parse_rich_type_value
9-
from pylint.lint import PyLinter
108
from pylint.testutils.checker_test_case import CheckerTestCase
119

1210

@@ -20,32 +18,7 @@ def set_config(**kwargs):
2018
def _wrapper(fun):
2119
@functools.wraps(fun)
2220
def _forward(self, *args, **test_function_kwargs):
23-
try:
24-
for key, value in kwargs.items():
25-
self.checker.set_option(key.replace("_", "-"), value)
26-
except optparse.OptionError:
27-
# Check if option is one of the base options of the PyLinter class
28-
for key, value in kwargs.items():
29-
try:
30-
self.checker.set_option(
31-
key.replace("_", "-"),
32-
value,
33-
optdict=dict(PyLinter().make_options())[
34-
key.replace("_", "-")
35-
],
36-
)
37-
except KeyError:
38-
# pylint: disable-next=fixme
39-
# TODO: Find good way to double load checkers in unittests
40-
# When options are used by multiple checkers we need to load both of them
41-
# to be able to get an optdict
42-
self.checker.set_option(
43-
key.replace("_", "-"),
44-
value,
45-
optdict={},
46-
)
47-
48-
# Set option via argparse
21+
"""Set option via argparse."""
4922
# pylint: disable-next=fixme
5023
# TODO: Revisit this decorator after all checkers have switched
5124
options = []

0 commit comments

Comments
 (0)