Method: pylint.testutils.configuration_test.run_using_a_configuration_file
Calls: 61, Exceptions: 0, Paths: 1Back
Path 1: 61 calls (1.0)
'$tmp_path_env' (1) '/private/var/folders/yp/qx0crmvd4sbck7chb52sws500000gn/T/pytest-of-andrehora/pytest-178/test_functional_config_loading0/pylintrc'...
'/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/file_to_lint.py' (61)
tuple (61)
1def run_using_a_configuration_file(
2 configuration_path: Path | str, file_to_lint: str = __file__
3) -> tuple[Mock, Mock, Run]:
4 """Simulate a run with a configuration without really launching the checks."""
5 configuration_path = str(configuration_path)
6 args = ["--rcfile", configuration_path, file_to_lint]
7 # We do not capture the `SystemExit` as then the `runner` variable
8 # would not be accessible outside the `with` block.
9 with unittest.mock.patch("sys.exit") as mocked_exit:
10 # Do not actually run checks, that could be slow. We don't mock
11 # `PyLinter.check`: it calls `PyLinter.initialize` which is
12 # needed to properly set up messages inclusion/exclusion
13 # in `_msg_states`, used by `is_message_enabled`.
14 check = "pylint.lint.pylinter.check_parallel"
15 with unittest.mock.patch(check) as mocked_check_parallel:
16 runner = Run(args)
17 return mocked_exit, mocked_check_parallel, runner