diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-03-20 14:16:59 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-03-21 10:23:27 -0500 |
| commit | a4cc9d6fa89deec98c586dfb3c8bf9da1d8c9d6e (patch) | |
| tree | 0cf0cc8f8c8e3d1d885056601f396c48e7257a10 /tests | |
| parent | a1c1247cba53e8e3160f00b9e923db5b36b3d131 (diff) | |
| download | flake8-a4cc9d6fa89deec98c586dfb3c8bf9da1d8c9d6e.tar.gz | |
Add test for reading from stdin with the file processor
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_file_processor.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py index 6e72a12..c09f203 100644 --- a/tests/unit/test_file_processor.py +++ b/tests/unit/test_file_processor.py @@ -3,6 +3,7 @@ import optparse from flake8 import processor +import mock import pytest @@ -46,3 +47,14 @@ def test_should_ignore_file(lines, expected): """Verify that we ignore a file if told to.""" file_processor = processor.FileProcessor('-', options_from(), lines) 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) |
