mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-16 00:59:52 +00:00
Do not print the source when provided with -q
When users specify any number of -q's on the command-line, we should not show the source even if they have otherwwise configured Flake8 to do so. Closes #245
This commit is contained in:
parent
ca4f631fb2
commit
5dfb93c0d0
3 changed files with 74 additions and 0 deletions
28
tests/unit/test_nothing_formatter.py
Normal file
28
tests/unit/test_nothing_formatter.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"""Tests for the Nothing formatter obbject."""
|
||||
import optparse
|
||||
|
||||
from flake8 import style_guide
|
||||
from flake8.formatting import default
|
||||
|
||||
|
||||
def options(**kwargs):
|
||||
"""Create an optparse.Values instance."""
|
||||
kwargs.setdefault('output_file', None)
|
||||
kwargs.setdefault('tee', False)
|
||||
return optparse.Values(kwargs)
|
||||
|
||||
|
||||
def test_format_returns_nothing():
|
||||
"""Verify Nothing.format returns None."""
|
||||
formatter = default.Nothing(options())
|
||||
error = style_guide.Error('code', 'file.py', 1, 1, 'text', '1')
|
||||
|
||||
assert formatter.format(error) is None
|
||||
|
||||
|
||||
def test_show_source_returns_nothing():
|
||||
"""Verify Nothing.show_source returns None."""
|
||||
formatter = default.Nothing(options())
|
||||
error = style_guide.Error('code', 'file.py', 1, 1, 'text', '1')
|
||||
|
||||
assert formatter.show_source(error) is None
|
||||
Loading…
Add table
Add a link
Reference in a new issue