Displaying the filename when the check-json hook fails with a UnicodeDecodeError - fix #148

This commit is contained in:
Lucas Cimon 2016-11-12 09:15:10 +01:00
parent 4ef03c4223
commit 54e83f7ceb
3 changed files with 9 additions and 2 deletions

View file

@ -6,8 +6,12 @@ from testing.util import get_resource_path
@pytest.mark.parametrize(('filename', 'expected_retval'), (
('bad_json.notjson', 1),
('bad_json_latin1.nonjson', 1),
('ok_json.json', 0),
))
def test_check_json(filename, expected_retval):
def test_check_json(capsys, filename, expected_retval):
ret = check_json([get_resource_path(filename)])
assert ret == expected_retval
if expected_retval == 1:
stdout, _ = capsys.readouterr()
assert filename in stdout