Skip to content

Commit

Permalink
Add a regression test for #4746
Browse files Browse the repository at this point in the history
This permits to introduce an example of configuration file with an error.
  • Loading branch information
Pierre-Sassoulas committed Nov 12, 2021
1 parent 5eff414 commit 1f615a8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions pylint/config/option_manager_mixin.py
Expand Up @@ -271,6 +271,9 @@ def read_config_file(self, config_file=None, verbose=None):

use_config_file = config_file and os.path.exists(config_file)
if use_config_file:
mod_name = config_file
self.current_name = mod_name
self.set_current_module(mod_name)
parser = self.cfgfile_parser
if config_file.endswith(".toml"):
self._parse_toml(config_file, parser)
Expand Down
9 changes: 4 additions & 5 deletions pylint/testutils/configuration_test.py
Expand Up @@ -76,8 +76,8 @@ def get_expected_output(configuration_path: str) -> Tuple[int, str]:

def get_relative_path(path: str) -> str:
"""Get the relative path we want without the user specific path"""
# Second [1:] is to remove the closing '/'
return "".join(path.split(USER_SPECIFIC_PATH)[1:][1:])
# [1:] is to remove the opening '/'
return path.split(USER_SPECIFIC_PATH)[1][1:]

output = get_expected_or_default(configuration_path, suffix="out", default="")
if output:
Expand All @@ -91,9 +91,8 @@ def get_relative_path(path: str) -> str:
else:
logging.info(".out file does not exists, so the expected exit code is 0")
exit_code = 0
return exit_code, output.format(
abspath=configuration_path, relpath=get_relative_path(configuration_path)
)
relpath = get_relative_path(configuration_path)
return exit_code, output.format(abspath=configuration_path, relpath=relpath)


def run_using_a_configuration_file(
Expand Down
@@ -0,0 +1,2 @@
************* Module {abspath}
{relpath}:1:0: E0013: Plugin 'pylint_websockets' is impossible to load, is it installed ? ('No module named 'pylint_websockets'') (bad-plugin-value)
@@ -0,0 +1,3 @@
{
"load_plugins": ["pylint_websockets"]
}
@@ -0,0 +1,8 @@
# The pylint_websockets plugin does not exist and therefore this toml is invalid
[tool.poe.tasks]
docs = {cmd = "sphinx-build docs build", help = "Build documentation"}

[tool.pylint.MASTER]
load-plugins = 'pylint_websockets'

format = ["black", "isort"]

0 comments on commit 1f615a8

Please sign in to comment.