summaryrefslogtreecommitdiff
path: root/tests/test_self.py
diff options
context:
space:
mode:
authorDaniel Harding <dharding@living180.net>2022-12-15 13:22:24 +0300
committerDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-12-15 22:50:31 +0100
commitb1d3f5a007d59e66d21a65dcee1302341779f436 (patch)
treed934b9497db8b5eb6ef0f9b821224b57f577840b /tests/test_self.py
parent27667f5678a131d2c5caf982c503e45544d69c24 (diff)
downloadpylint-git-b1d3f5a007d59e66d21a65dcee1302341779f436.tar.gz
Add test for ModuleNotFoundError fix
Refs #7938
Diffstat (limited to 'tests/test_self.py')
-rw-r--r--tests/test_self.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_self.py b/tests/test_self.py
index 02e1a17e8..61b417f0c 100644
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -869,6 +869,19 @@ a.py:1:4: E0001: Parsing failed: 'invalid syntax (<unknown>, line 1)' (syntax-er
modify_sys_path()
assert sys.path == paths[1:]
+ @staticmethod
+ def test_plugin_that_imports_from_open() -> None:
+ """Test that a plugin that imports a source file from a checker open()
+ function (ala pylint_django) does not raise an exception."""
+ with _test_sys_path():
+ # Enable --load-plugins=importing_plugin
+ sys.path.append(join(HERE, "regrtest_data", "importing_plugin"))
+ with _test_cwd(join(HERE, "regrtest_data", "settings_project")):
+ Run(
+ ["--load-plugins=importing_plugin", "models.py"],
+ exit=False,
+ )
+
@pytest.mark.parametrize(
"args",
[