mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-08 04:34:16 +00:00
Add test for std err
This commit is contained in:
parent
831d2a99ab
commit
35c76c4f33
1 changed files with 6 additions and 3 deletions
|
|
@ -108,6 +108,7 @@ def test_badfile_main():
|
||||||
|
|
||||||
|
|
||||||
def test_diffing_output(capsys):
|
def test_diffing_output(capsys):
|
||||||
|
resource_path = get_resource_path('not_pretty_formatted_json.json')
|
||||||
expected_retval = 1
|
expected_retval = 1
|
||||||
expected_out = ''' {
|
expected_out = ''' {
|
||||||
- "foo":
|
- "foo":
|
||||||
|
|
@ -125,9 +126,11 @@ def test_diffing_output(capsys):
|
||||||
}
|
}
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
expected_err = 'File {} is not pretty-formatted\n'.format(resource_path)
|
||||||
|
|
||||||
actual_retval = main([get_resource_path('not_pretty_formatted_json.json')])
|
actual_retval = main([resource_path])
|
||||||
out, err = capsys.readouterr()
|
actual_out, actual_err = capsys.readouterr()
|
||||||
|
|
||||||
assert actual_retval == expected_retval
|
assert actual_retval == expected_retval
|
||||||
assert out == expected_out
|
assert actual_out == expected_out
|
||||||
|
assert actual_err == expected_err
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue