summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2023-05-14 09:06:16 -0400
committerGitHub <noreply@github.com>2023-05-14 09:06:16 -0400
commit4e48d46b7239c2d7a70a05929fd49595d45cc29f (patch)
treeacec40ebd24109f8ef06ed8b93c0f940fa24ea9a /tests
parentaed3c080388a8dc1d44c1a14a5ed243233f77c1c (diff)
downloadpylint-git-4e48d46b7239c2d7a70a05929fd49595d45cc29f.tar.gz
Load custom plugins when linting in parallel (#8683)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_check_parallel.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_check_parallel.py b/tests/test_check_parallel.py
index 24f958406..d56502eaf 100644
--- a/tests/test_check_parallel.py
+++ b/tests/test_check_parallel.py
@@ -14,10 +14,11 @@ import sys
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures.process import BrokenProcessPool
from pickle import PickleError
+from typing import TYPE_CHECKING
+from unittest.mock import patch
import dill
import pytest
-from astroid import nodes
import pylint.interfaces
import pylint.lint.parallel
@@ -30,6 +31,9 @@ from pylint.testutils import GenericTestReporter as Reporter
from pylint.typing import FileItem
from pylint.utils import LinterStats, ModuleStats
+if TYPE_CHECKING:
+ from astroid import nodes
+
def _gen_file_data(idx: int = 0) -> FileItem:
"""Generates a file to use as a stream."""
@@ -182,6 +186,17 @@ class TestCheckParallelFramework:
)
assert "fake-path" in sys.path
+ def test_worker_initialize_reregisters_custom_plugins(self) -> None:
+ linter = PyLinter(reporter=Reporter())
+ linter.load_plugin_modules(["pylint.extensions.private_import"])
+
+ pickled = dill.dumps(linter)
+ with patch(
+ "pylint.extensions.private_import.register", side_effect=AssertionError
+ ):
+ with pytest.raises(AssertionError):
+ worker_initialize(linter=pickled)
+
@pytest.mark.needs_two_cores
def test_worker_initialize_pickling(self) -> None:
"""Test that we can pickle objects that standard pickling in multiprocessing can't.