mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-13 16:14:18 +00:00
Add unit tests around serial retries
This commit is contained in:
parent
e3707bbe08
commit
eb3d8f5791
1 changed files with 27 additions and 0 deletions
27
tests/unit/test_checker_manager.py
Normal file
27
tests/unit/test_checker_manager.py
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
"""Tests for the Manager object for FileCheckers."""
|
||||||
|
import errno
|
||||||
|
import mock
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from flake8 import checker
|
||||||
|
|
||||||
|
|
||||||
|
def test_oserrors_cause_serial_fall_back():
|
||||||
|
"""Verify that OSErrors will cause the Manager to fallback to serial."""
|
||||||
|
err = OSError(errno.ENOSPC, 'Ominous message about spaceeeeee')
|
||||||
|
style_guide = mock.Mock()
|
||||||
|
style_guide.options = mock.Mock(diff=False, jobs='4')
|
||||||
|
with mock.patch('multiprocessing.Queue', side_effect=err):
|
||||||
|
manager = checker.Manager(style_guide, [], [])
|
||||||
|
assert manager.using_multiprocessing is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_oserrors_are_reraised():
|
||||||
|
"""Verify that OSErrors will cause the Manager to fallback to serial."""
|
||||||
|
err = OSError(errno.EAGAIN, 'Ominous message')
|
||||||
|
style_guide = mock.Mock()
|
||||||
|
style_guide.options = mock.Mock(diff=False, jobs='4')
|
||||||
|
with mock.patch('multiprocessing.Queue', side_effect=err):
|
||||||
|
with pytest.raises(OSError):
|
||||||
|
checker.Manager(style_guide, [], [])
|
||||||
Loading…
Add table
Add a link
Reference in a new issue