This commit is contained in:
marqueewinq 2019-09-20 15:05:51 +03:00
parent 0245a67831
commit 247d45af05
3 changed files with 34 additions and 14 deletions

View file

@ -164,11 +164,14 @@ def test_expected_fatal_error_no_git_repo(in_tmpdir, cap_out, mock_store_dir):
with pytest.raises(SystemExit):
main.main([])
log_file = os.path.join(mock_store_dir, 'pre-commit.log')
assert cap_out.get() == (
cap_out_lines = cap_out.get().split('\n')
assert (
cap_out_lines[0] ==
'An error has occurred: FatalError: git failed. '
'Is it installed, and are you in a Git repository directory?\n'
'Check the log at {}\n'.format(log_file)
'Is it installed, and are you in a Git repository directory?'
)
assert cap_out_lines[-2] == 'Check the log at {}'.format(log_file)
assert cap_out_lines[-1] == '' # checks for \n at the end of error message
def test_warning_on_tags_only(mock_commands, cap_out, mock_store_dir):