mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 21:16:54 +00:00
satisfying the linter
This commit is contained in:
parent
764ecb0e48
commit
fab65e5208
2 changed files with 11 additions and 9 deletions
|
|
@ -138,6 +138,7 @@ def test_write_produces_stdout(capsys):
|
|||
|
||||
@pytest.mark.parametrize('buffered_stdout', [True, False])
|
||||
def test_write_hook_fallbacks(buffered_stdout):
|
||||
"""Varify stdout.write() fallbacks."""
|
||||
mock_line = mock.Mock(name='Mock Line')
|
||||
|
||||
stdout_spec = ['write', 'encoding']
|
||||
|
|
@ -145,11 +146,11 @@ def test_write_hook_fallbacks(buffered_stdout):
|
|||
stdout_spec.append('buffer')
|
||||
|
||||
with mock.patch('sys.stdout', spec=stdout_spec) as mock_stdout:
|
||||
def _stdoutWriteEffect(value):
|
||||
def _stdout_write_effect(value):
|
||||
if value is mock_line:
|
||||
raise UnicodeEncodeError('unittest-codec', u'', 42, 43, 'NOPE')
|
||||
return None
|
||||
mock_stdout.write.side_effect = _stdoutWriteEffect
|
||||
mock_stdout.write.side_effect = _stdout_write_effect
|
||||
|
||||
mock_stdout.encoding = 'ascii'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue