summaryrefslogtreecommitdiff
path: root/tests/test_check_parallel.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_check_parallel.py')
-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.