summaryrefslogtreecommitdiff
path: root/tests/config
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-05-05 15:07:46 +0200
committerGitHub <noreply@github.com>2022-05-05 15:07:46 +0200
commit020aea5797eb9f858b44dc6157f4b018234df50a (patch)
treeef0578b9cf94aa99b22cce7af1e3a1322a6ca526 /tests/config
parent30a56fbd804882f0acc9d251f237b6c50ef91672 (diff)
downloadpylint-git-020aea5797eb9f858b44dc6157f4b018234df50a.tar.gz
Fix the loading of unrelated tools options (#6356)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/functional/setup_cfg/deprecate_master/setup.cfg3
-rw-r--r--tests/config/functional/setup_cfg/deprecate_master/setup.result.json3
-rw-r--r--tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.2.out2
-rw-r--r--tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.cfg10
-rw-r--r--tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.result.json10
-rw-r--r--tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg6
-rw-r--r--tests/config/functional/setup_cfg/identical_name_in_flake8/setup.result.json1
-rw-r--r--tests/config/test_functional_config_loading.py11
8 files changed, 43 insertions, 3 deletions
diff --git a/tests/config/functional/setup_cfg/deprecate_master/setup.cfg b/tests/config/functional/setup_cfg/deprecate_master/setup.cfg
new file mode 100644
index 000000000..fd6381646
--- /dev/null
+++ b/tests/config/functional/setup_cfg/deprecate_master/setup.cfg
@@ -0,0 +1,3 @@
+# Test the deprecation of MASTER
+[MASTER]
+persistent=no
diff --git a/tests/config/functional/setup_cfg/deprecate_master/setup.result.json b/tests/config/functional/setup_cfg/deprecate_master/setup.result.json
new file mode 100644
index 000000000..b66b78598
--- /dev/null
+++ b/tests/config/functional/setup_cfg/deprecate_master/setup.result.json
@@ -0,0 +1,3 @@
+{
+ "persistent": false
+}
diff --git a/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.2.out b/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.2.out
new file mode 100644
index 000000000..ddb88ed15
--- /dev/null
+++ b/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.2.out
@@ -0,0 +1,2 @@
+************* Module {abspath}
+{relpath}:1:0: E0012: Bad option value for --enable. Don't recognize message useless-supression. (bad-option-value)
diff --git a/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.cfg b/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.cfg
new file mode 100644
index 000000000..b12db80e0
--- /dev/null
+++ b/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.cfg
@@ -0,0 +1,10 @@
+[myothertool]
+ignore = allthefiles
+
+[pylint.MESSAGES CONTROL]
+extension-pkg-whitelist=pygame
+enable=
+ useless-supression,
+
+disable=
+ missing-docstring,
diff --git a/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.result.json b/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.result.json
new file mode 100644
index 000000000..78e3df360
--- /dev/null
+++ b/tests/config/functional/setup_cfg/do_not_read_other_tools_configuration/setup.result.json
@@ -0,0 +1,10 @@
+{
+ "functional_append": {
+ "disable": [
+ "missing-class-docstring",
+ "missing-function-docstring",
+ "missing-module-docstring"
+ ]
+ },
+ "extension_pkg_whitelist": ["pygame"]
+}
diff --git a/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg
new file mode 100644
index 000000000..df4ec3926
--- /dev/null
+++ b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.cfg
@@ -0,0 +1,6 @@
+# Test for the behavior of https://github.com/PyCQA/pylint/issues/4371
+[pylint.MASTER]
+persistent=no
+ignore = migrations
+[flake8]
+ignore = D107,D400,D401
diff --git a/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.result.json b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.result.json
new file mode 100644
index 000000000..d515c15b5
--- /dev/null
+++ b/tests/config/functional/setup_cfg/identical_name_in_flake8/setup.result.json
@@ -0,0 +1 @@
+{ "persistent": false, "ignore": ["migrations"], "black_list": ["migrations"] }
diff --git a/tests/config/test_functional_config_loading.py b/tests/config/test_functional_config_loading.py
index e4ed15051..64227df79 100644
--- a/tests/config/test_functional_config_loading.py
+++ b/tests/config/test_functional_config_loading.py
@@ -19,6 +19,7 @@ and ``"functional_remove":``. Check the existing code for examples.
# pylint: disable=redefined-outer-name
import logging
+import warnings
from pathlib import Path
import pytest
@@ -78,9 +79,13 @@ def test_functional_config_loading(
expected_loaded_configuration = get_expected_configuration(
configuration_path, default_configuration
)
- mock_exit, _, runner = run_using_a_configuration_file(
- configuration_path, file_to_lint_path
- )
+ with warnings.catch_warnings():
+ warnings.filterwarnings(
+ "ignore", message="The use of 'MASTER'.*", category=UserWarning
+ )
+ mock_exit, _, runner = run_using_a_configuration_file(
+ configuration_path, file_to_lint_path
+ )
mock_exit.assert_called_once_with(expected_code)
out, err = capsys.readouterr()
# 'rstrip()' applied, so we can have a final newline in the expected test file