@@ -81,12 +81,12 @@ def test_log_and_exit(cap_out, mock_out_store_directory):
8181 )
8282
8383 printed = cap_out .get ()
84+ log_file = os .path .join (mock_out_store_directory , 'pre-commit.log' )
8485 assert printed == (
8586 'msg: FatalError: hai\n '
86- 'Check the log at ~/.pre-commit/pre-commit.log \n '
87+ 'Check the log at {} \n ' . format ( log_file )
8788 )
8889
89- log_file = os .path .join (mock_out_store_directory , 'pre-commit.log' )
9090 assert os .path .exists (log_file )
9191 contents = io .open (log_file ).read ()
9292 assert contents == (
@@ -102,6 +102,7 @@ def test_error_handler_non_ascii_exception(mock_out_store_directory):
102102
103103
104104def test_error_handler_no_tty (tempdir_factory ):
105+ pre_commit_home = tempdir_factory .get ()
105106 output = cmd_output_mocked_pre_commit_home (
106107 sys .executable , '-c' ,
107108 'from __future__ import unicode_literals\n '
@@ -110,8 +111,10 @@ def test_error_handler_no_tty(tempdir_factory):
110111 ' raise ValueError("\\ u2603")\n ' ,
111112 retcode = 1 ,
112113 tempdir_factory = tempdir_factory ,
114+ pre_commit_home = pre_commit_home ,
113115 )
116+ log_file = os .path .join (pre_commit_home , 'pre-commit.log' )
114117 assert output [1 ].replace ('\r ' , '' ) == (
115118 'An unexpected error has occurred: ValueError: ☃\n '
116- 'Check the log at ~/.pre-commit/pre-commit.log \n '
119+ 'Check the log at {} \n ' . format ( log_file )
117120 )
0 commit comments