Skip to content

Commit

Permalink
Add ignored modules to Astroid module deny list
Browse files Browse the repository at this point in the history
Work towards pylint-dev#9442
  • Loading branch information
Jamie- committed Mar 15, 2024
1 parent 04e7f7a commit 7bbbe76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,7 @@ def open(self) -> None:
MANAGER.always_load_extensions = self.config.unsafe_load_any_extension
MANAGER.max_inferable_values = self.config.limit_inference_results
MANAGER.extension_package_whitelist.update(self.config.extension_pkg_allow_list)
MANAGER.module_denylist.update(self.config.ignored_modules)
if self.config.extension_pkg_whitelist:
MANAGER.extension_package_whitelist.update(
self.config.extension_pkg_whitelist
Expand Down
10 changes: 9 additions & 1 deletion tests/lint/test_pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from pytest import CaptureFixture

from pylint.lint.pylinter import PyLinter
from pylint.lint.pylinter import PyLinter, MANAGER
from pylint.utils import FileState


Expand Down Expand Up @@ -48,3 +48,11 @@ def test_crash_during_linting(
assert len(files) == 1
assert "pylint-crash-20" in str(files[0])
assert any(m.symbol == "astroid-error" for m in linter.reporter.messages)


def test_open_pylinter_denied_modules(linter: PyLinter) -> None:
"""test PyLinter open() adds ignored modules to Astroid manager deny list"""
MANAGER.module_denylist = {"mod1"}
linter.config.ignored_modules = ["mod2", "mod3"]
linter.open()
assert MANAGER.module_denylist == {"mod1", "mod2", "mod3"}

0 comments on commit 7bbbe76

Please sign in to comment.