Method: pylint.testutils.decorator.set_config
Calls: 49, Exceptions: 0, Paths: 1Back
Path 1: 49 calls (1.0)
{'spelling_dict': None} (27) dict (13) {'ignore_paths': ''} (2) {'exclude_too_few_public_methods': 'toml.*'} (1) {'max_spelling_suggestions': 2} (1) {...
set_config.
1def set_config(**kwargs: Any) -> Callable[[Callable[..., None]], Callable[..., None]]:
2 """Decorator for setting an option on the linter.
3
4 Passing the args and kwargs back to the test function itself
5 allows this decorator to be used on parameterized test cases.
6 """
7
8 def _wrapper(fun: Callable[..., None]) -> Callable[..., None]:
9 @functools.wraps(fun)
10 def _forward(
11 self: CheckerTestCase, *args: Any, **test_function_kwargs: Any
12 ) -> None:
13 """Set option via argparse."""
14 for key, value in kwargs.items():
15 self.linter.set_option(key, value)
16
17 # Reopen checker in case, it may be interested in configuration change
18 self.checker.open()
19
20 fun(self, *args, **test_function_kwargs)
21
22 return _forward
23
24 return _wrapper