mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
Serialize Checkers PluginTypeManager to a dict
It seems likely that the multiprocessing module on Windows is not capable of serializing an object with the structure that we have and preserving the attributes we dynamically set on plugins (like the FlakesChecker). To avoid issues like this with all plugins (although we have only found this on Windows with the FlakesChecker), let's try serializing the Checkers PluginTypeManager to a dictionary so that the only object that a Queue is really trying to serialize/deserialize is the FlakesChecker itself. Related to #179
This commit is contained in:
parent
7e806824df
commit
e14d0e6352
6 changed files with 65 additions and 27 deletions
|
|
@ -47,8 +47,14 @@ def test_make_checkers():
|
|||
"""Verify that we create a list of FileChecker instances."""
|
||||
style_guide = style_guide_mock()
|
||||
files = ['file1', 'file2']
|
||||
checkplugins = mock.Mock()
|
||||
checkplugins.to_dictionary.return_value = {
|
||||
'ast_plugins': [],
|
||||
'logical_line_plugins': [],
|
||||
'physical_line_plugins': [],
|
||||
}
|
||||
with mock.patch('flake8.checker.multiprocessing', None):
|
||||
manager = checker.Manager(style_guide, files, [])
|
||||
manager = checker.Manager(style_guide, files, checkplugins)
|
||||
|
||||
with mock.patch('flake8.utils.filenames_from') as filenames_from:
|
||||
filenames_from.side_effect = [['file1'], ['file2']]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue