@@ -18,13 +18,15 @@ def get_resource_path(path):
1818 return os .path .join (TESTING_DIR , 'resources' , path )
1919
2020
21- def cmd_output_mocked_pre_commit_home (* args , ** kwargs ):
22- # keyword-only argument
23- tempdir_factory = kwargs .pop ('tempdir_factory' )
24- pre_commit_home = kwargs .pop ('pre_commit_home' , tempdir_factory .get ())
21+ def cmd_output_mocked_pre_commit_home (
22+ * args , tempdir_factory , pre_commit_home = None , env = None , ** kwargs ,
23+ ):
24+ if pre_commit_home is None :
25+ pre_commit_home = tempdir_factory .get ()
26+ env = env if env is not None else os .environ
2527 kwargs .setdefault ('stderr' , subprocess .STDOUT )
2628 # Don't want to write to the home directory
27- env = dict (kwargs . pop ( ' env' , os . environ ) , PRE_COMMIT_HOME = pre_commit_home )
29+ env = dict (env , PRE_COMMIT_HOME = pre_commit_home )
2830 ret , out , _ = cmd_output (* args , env = env , ** kwargs )
2931 return ret , out .replace ('\r \n ' , '\n ' ), None
3032
@@ -123,9 +125,7 @@ def cwd(path):
123125 os .chdir (original_cwd )
124126
125127
126- def git_commit (* args , ** kwargs ):
127- fn = kwargs .pop ('fn' , cmd_output )
128- msg = kwargs .pop ('msg' , 'commit!' )
128+ def git_commit (* args , fn = cmd_output , msg = 'commit!' , ** kwargs ):
129129 kwargs .setdefault ('stderr' , subprocess .STDOUT )
130130
131131 cmd = ('git' , 'commit' , '--allow-empty' , '--no-gpg-sign' , '-a' ) + args
0 commit comments