mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-16 17:19:52 +00:00
Do better testing that we actually call run_serial().
This commit is contained in:
parent
a5573fc864
commit
c16c0c9041
1 changed files with 6 additions and 2 deletions
|
|
@ -22,7 +22,9 @@ def test_oserrors_cause_serial_fall_back():
|
||||||
style_guide = style_guide_mock()
|
style_guide = style_guide_mock()
|
||||||
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
||||||
manager = checker.Manager(style_guide, [], [])
|
manager = checker.Manager(style_guide, [], [])
|
||||||
manager.run()
|
with mock.patch.object(manager, 'run_serial') as serial:
|
||||||
|
manager.run()
|
||||||
|
assert serial.call_count == 1
|
||||||
assert manager.using_multiprocessing is False
|
assert manager.using_multiprocessing is False
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -34,7 +36,9 @@ def test_oserrors_are_reraised(is_windows):
|
||||||
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
manager = checker.Manager(style_guide, [], [])
|
manager = checker.Manager(style_guide, [], [])
|
||||||
manager.run()
|
with mock.patch.object(manager, 'run_serial') as serial:
|
||||||
|
manager.run()
|
||||||
|
assert serial.call_count == 0
|
||||||
|
|
||||||
|
|
||||||
def test_multiprocessing_is_disabled():
|
def test_multiprocessing_is_disabled():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue