summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-03-12 21:31:37 +0100
committerGitHub <noreply@github.com>2022-03-12 21:31:37 +0100
commit5756fae16b336e8828f6d220c532dc48ddd04183 (patch)
tree0ab4a7eb69d8047699a7eecf0d154244dda6c765 /tests
parent29480d4e119b27ab419c5d53e8a955220de61e43 (diff)
downloadpylint-git-5756fae16b336e8828f6d220c532dc48ddd04183.tar.gz
Fix disabling of ``ungrouped-imports`` (#5903)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/u/ungrouped_imports_suppression.py15
-rw-r--r--tests/functional/u/ungrouped_imports_suppression.txt2
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/functional/u/ungrouped_imports_suppression.py b/tests/functional/u/ungrouped_imports_suppression.py
new file mode 100644
index 000000000..9b482b355
--- /dev/null
+++ b/tests/functional/u/ungrouped_imports_suppression.py
@@ -0,0 +1,15 @@
+"""Check ungrouped import and interaction with useless-suppression.
+
+Previously disabling ungrouped-imports would always lead to useless-suppression.
+"""
+# pylint: enable=useless-suppression
+# pylint: disable=unused-import, wrong-import-order
+
+import logging.config
+import os.path
+from astroid import are_exclusive # pylint: disable=ungrouped-imports # [useless-suppression]
+import logging.handlers # pylint: disable=ungrouped-imports # This should not raise useless-suppression
+try:
+ import os # [ungrouped-imports]
+except ImportError:
+ pass
diff --git a/tests/functional/u/ungrouped_imports_suppression.txt b/tests/functional/u/ungrouped_imports_suppression.txt
new file mode 100644
index 000000000..3ba8b0ea0
--- /dev/null
+++ b/tests/functional/u/ungrouped_imports_suppression.txt
@@ -0,0 +1,2 @@
+useless-suppression:10:0:None:None::Useless suppression of 'ungrouped-imports':UNDEFINED
+ungrouped-imports:13:4:13:13::Imports from package os are not grouped:UNDEFINED