summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorLeonardo Rochael Almeida <leorochael@gmail.com>2016-07-20 17:22:49 -0300
committerLeonardo Rochael Almeida <leorochael@gmail.com>2016-07-20 18:45:01 -0300
commit7934f8dce2fc1c5d8da374a3c7435d36f9526b0b (patch)
tree65be71e2def5f9f5b07e697e10c2ae0080224964 /tests/unit
parentb2b4cae8e3ef27b8545a8d98a35dc7b07b1b132f (diff)
downloadflake8-7934f8dce2fc1c5d8da374a3c7435d36f9526b0b.tar.gz
Propagate the stdin_display_name to checker and processor
This way plugins like flake8-putty can have access to the correct filename.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_file_processor.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py
index dec1667..8bc0e2d 100644
--- a/tests/unit/test_file_processor.py
+++ b/tests/unit/test_file_processor.py
@@ -14,6 +14,7 @@ def options_from(**kwargs):
kwargs.setdefault('hang_closing', True)
kwargs.setdefault('max_line_length', 79)
kwargs.setdefault('verbose', False)
+ kwargs.setdefault('stdin_display_name', None)
return optparse.Values(kwargs)
@@ -63,13 +64,17 @@ def test_read_lines_from_stdin(stdin_get_value):
@mock.patch('flake8.utils.stdin_get_value')
-def test_read_lines_sets_filename_attribute(stdin_get_value):
+def test_stdin_filename_attribute(stdin_get_value):
"""Verify that we update the filename attribute."""
stdin_value = mock.Mock()
stdin_value.splitlines.return_value = []
stdin_get_value.return_value = stdin_value
file_processor = processor.FileProcessor('-', options_from())
assert file_processor.filename == 'stdin'
+ file_processor = processor.FileProcessor('-', options_from(
+ stdin_display_name="foo.py"
+ ))
+ assert file_processor.filename == 'foo.py'
def test_line_for():