summaryrefslogtreecommitdiff
path: root/tests/checkers
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2023-03-21 23:29:58 +0100
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2023-03-21 23:44:57 +0100
commitd64c0cc1484b0cbea5fd3a9dfac4c0d6ddc7d1aa (patch)
tree1590ef2015db4692adb04f52940e7b7176d01a10 /tests/checkers
parentb59009a4322d8faa8c86c97853cc1d8224241b86 (diff)
downloadpylint-git-d64c0cc1484b0cbea5fd3a9dfac4c0d6ddc7d1aa.tar.gz
Fix incorrect preferred-modules matches
Co-authored-by: d33bs <dave.bunten@cuanschutz.edu>
Diffstat (limited to 'tests/checkers')
-rw-r--r--tests/checkers/unittest_imports.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/checkers/unittest_imports.py b/tests/checkers/unittest_imports.py
index 7544e3422..d454c8161 100644
--- a/tests/checkers/unittest_imports.py
+++ b/tests/checkers/unittest_imports.py
@@ -192,6 +192,23 @@ class TestImportsChecker(CheckerTestCase):
# assert there were no errors
assert len(errors) == 0
+ # Test for challenges with preferred modules indefinite matches
+ Run(
+ [
+ f"{os.path.join(REGR_DATA, 'preferred_module/unpreferred_submodule.py')}",
+ "-d all",
+ "-e preferred-module",
+ # prefer pathlib instead of random (testing to avoid regression)
+ # pathlib shouldn't match with path, which is in the test file
+ "--preferred-modules=random:pathlib",
+ ],
+ exit=False,
+ )
+ _, errors = capsys.readouterr()
+
+ # Assert there were no errors
+ assert len(errors) == 0
+
@staticmethod
def test_allow_reexport_package(capsys: CaptureFixture[str]) -> None:
"""Test --allow-reexport-from-package option."""