@@ -248,7 +248,7 @@ def test_install_idempotent(tempdir_factory, store):
248248def _path_without_us ():
249249 # Choose a path which *probably* doesn't include us
250250 env = dict (os .environ )
251- exe = find_executable ('pre-commit' , _environ = env )
251+ exe = find_executable ('pre-commit' , env = env )
252252 while exe :
253253 parts = env ['PATH' ].split (os .pathsep )
254254 after = [
@@ -258,7 +258,7 @@ def _path_without_us():
258258 if parts == after :
259259 raise AssertionError (exe , parts )
260260 env ['PATH' ] = os .pathsep .join (after )
261- exe = find_executable ('pre-commit' , _environ = env )
261+ exe = find_executable ('pre-commit' , env = env )
262262 return env ['PATH' ]
263263
264264
@@ -276,18 +276,19 @@ def test_environment_not_sourced(tempdir_factory, store):
276276
277277 # Use a specific homedir to ignore --user installs
278278 homedir = tempdir_factory .get ()
279- ret , out = git_commit (
280- env = {
281- 'HOME' : homedir ,
282- 'PATH' : _path_without_us (),
283- # Git needs this to make a commit
284- 'GIT_AUTHOR_NAME' : os .environ ['GIT_AUTHOR_NAME' ],
285- 'GIT_COMMITTER_NAME' : os .environ ['GIT_COMMITTER_NAME' ],
286- 'GIT_AUTHOR_EMAIL' : os .environ ['GIT_AUTHOR_EMAIL' ],
287- 'GIT_COMMITTER_EMAIL' : os .environ ['GIT_COMMITTER_EMAIL' ],
288- },
289- check = False ,
290- )
279+ env = {
280+ 'HOME' : homedir ,
281+ 'PATH' : _path_without_us (),
282+ # Git needs this to make a commit
283+ 'GIT_AUTHOR_NAME' : os .environ ['GIT_AUTHOR_NAME' ],
284+ 'GIT_COMMITTER_NAME' : os .environ ['GIT_COMMITTER_NAME' ],
285+ 'GIT_AUTHOR_EMAIL' : os .environ ['GIT_AUTHOR_EMAIL' ],
286+ 'GIT_COMMITTER_EMAIL' : os .environ ['GIT_COMMITTER_EMAIL' ],
287+ }
288+ if os .name == 'nt' and 'PATHEXT' in os .environ : # pragma: no cover
289+ env ['PATHEXT' ] = os .environ ['PATHEXT' ]
290+
291+ ret , out = git_commit (env = env , check = False )
291292 assert ret == 1
292293 assert out == (
293294 '`pre-commit` not found. '
0 commit comments