mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +00:00
Add test for reading from stdin with the file processor
This commit is contained in:
parent
a1c1247cba
commit
a4cc9d6fa8
1 changed files with 12 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import optparse
|
||||||
|
|
||||||
from flake8 import processor
|
from flake8 import processor
|
||||||
|
|
||||||
|
import mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -46,3 +47,14 @@ def test_should_ignore_file(lines, expected):
|
||||||
"""Verify that we ignore a file if told to."""
|
"""Verify that we ignore a file if told to."""
|
||||||
file_processor = processor.FileProcessor('-', options_from(), lines)
|
file_processor = processor.FileProcessor('-', options_from(), lines)
|
||||||
assert file_processor.should_ignore_file() is expected
|
assert file_processor.should_ignore_file() is expected
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch('flake8.utils.stdin_get_value')
|
||||||
|
def test_read_lines_from_stdin(stdin_get_value):
|
||||||
|
"""Verify that we use our own utility function to retrieve stdin."""
|
||||||
|
stdin_value = mock.Mock()
|
||||||
|
stdin_value.splitlines.return_value = []
|
||||||
|
stdin_get_value.return_value = stdin_value
|
||||||
|
file_processor = processor.FileProcessor('-', options_from())
|
||||||
|
stdin_get_value.assert_called_once_with()
|
||||||
|
stdin_value.splitlines.assert_called_once_with(True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue