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:
Ian Cordasco 2016-07-27 08:15:56 -05:00
parent 7e806824df
commit e14d0e6352
No known key found for this signature in database
GPG key ID: 656D3395E4A9791A
6 changed files with 65 additions and 27 deletions

View file

@ -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']]