mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 06:44:18 +00:00
Merge branch 'formatter-print-observe-newline' into 'master'
Respect a formatter's newline setting when printing See merge request pycqa/flake8!222
This commit is contained in:
commit
6381d86f00
2 changed files with 5 additions and 5 deletions
|
|
@ -172,7 +172,7 @@ class BaseFormatter(object):
|
||||||
if self.output_fd is not None:
|
if self.output_fd is not None:
|
||||||
self.output_fd.write(output + self.newline)
|
self.output_fd.write(output + self.newline)
|
||||||
if self.output_fd is None or self.options.tee:
|
if self.output_fd is None or self.options.tee:
|
||||||
print(output)
|
print(output, end=self.newline)
|
||||||
|
|
||||||
def write(self, line, source):
|
def write(self, line, source):
|
||||||
"""Write the line either to the output file or stdout.
|
"""Write the line either to the output file or stdout.
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,8 @@ def test_write_uses_an_output_file(tee):
|
||||||
if tee:
|
if tee:
|
||||||
assert print_func.called
|
assert print_func.called
|
||||||
assert print_func.mock_calls == [
|
assert print_func.mock_calls == [
|
||||||
mock.call(line),
|
mock.call(line, end='\n'),
|
||||||
mock.call(source),
|
mock.call(source, end='\n'),
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
assert not print_func.called
|
assert not print_func.called
|
||||||
|
|
@ -118,8 +118,8 @@ def test_write_uses_print(print_function):
|
||||||
assert print_function.called is True
|
assert print_function.called is True
|
||||||
assert print_function.call_count == 2
|
assert print_function.call_count == 2
|
||||||
assert print_function.mock_calls == [
|
assert print_function.mock_calls == [
|
||||||
mock.call(line),
|
mock.call(line, end='\n'),
|
||||||
mock.call(source),
|
mock.call(source, end='\n'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue