mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
keyword only arguments in some places
This commit is contained in:
parent
34c3a1580a
commit
5779f93ec6
4 changed files with 17 additions and 20 deletions
|
|
@ -18,13 +18,15 @@ def get_resource_path(path):
|
|||
return os.path.join(TESTING_DIR, 'resources', path)
|
||||
|
||||
|
||||
def cmd_output_mocked_pre_commit_home(*args, **kwargs):
|
||||
# keyword-only argument
|
||||
tempdir_factory = kwargs.pop('tempdir_factory')
|
||||
pre_commit_home = kwargs.pop('pre_commit_home', tempdir_factory.get())
|
||||
def cmd_output_mocked_pre_commit_home(
|
||||
*args, tempdir_factory, pre_commit_home=None, env=None, **kwargs,
|
||||
):
|
||||
if pre_commit_home is None:
|
||||
pre_commit_home = tempdir_factory.get()
|
||||
env = env if env is not None else os.environ
|
||||
kwargs.setdefault('stderr', subprocess.STDOUT)
|
||||
# Don't want to write to the home directory
|
||||
env = dict(kwargs.pop('env', os.environ), PRE_COMMIT_HOME=pre_commit_home)
|
||||
env = dict(env, PRE_COMMIT_HOME=pre_commit_home)
|
||||
ret, out, _ = cmd_output(*args, env=env, **kwargs)
|
||||
return ret, out.replace('\r\n', '\n'), None
|
||||
|
||||
|
|
@ -123,9 +125,7 @@ def cwd(path):
|
|||
os.chdir(original_cwd)
|
||||
|
||||
|
||||
def git_commit(*args, **kwargs):
|
||||
fn = kwargs.pop('fn', cmd_output)
|
||||
msg = kwargs.pop('msg', 'commit!')
|
||||
def git_commit(*args, fn=cmd_output, msg='commit!', **kwargs):
|
||||
kwargs.setdefault('stderr', subprocess.STDOUT)
|
||||
|
||||
cmd = ('git', 'commit', '--allow-empty', '--no-gpg-sign', '-a') + args
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue