mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 20:26:53 +00:00
Move all uses of pool inside run_parallel().
This includes creating the pool, tearing it down under normal use, and tearing it down in case of exception. Doing this makes it harder to leak processes, as for instance was happening in #410. Fixes #410
This commit is contained in:
parent
f834499726
commit
a5573fc864
3 changed files with 34 additions and 34 deletions
|
|
@ -22,17 +22,19 @@ def test_oserrors_cause_serial_fall_back():
|
|||
style_guide = style_guide_mock()
|
||||
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
||||
manager = checker.Manager(style_guide, [], [])
|
||||
manager.run()
|
||||
assert manager.using_multiprocessing is False
|
||||
|
||||
|
||||
@mock.patch('flake8.utils.is_windows', return_value=False)
|
||||
def test_oserrors_are_reraised(is_windows):
|
||||
"""Verify that OSErrors will cause the Manager to fallback to serial."""
|
||||
"""Verify that unexpected OSErrors will cause the Manager to reraise."""
|
||||
err = OSError(errno.EAGAIN, 'Ominous message')
|
||||
style_guide = style_guide_mock()
|
||||
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
||||
with pytest.raises(OSError):
|
||||
checker.Manager(style_guide, [], [])
|
||||
manager = checker.Manager(style_guide, [], [])
|
||||
manager.run()
|
||||
|
||||
|
||||
def test_multiprocessing_is_disabled():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue