pre-commit-hooks/tests/conftest.py
Nicholas Devenish 31e32bc0af Override the developer's global git branch name in tests
Setting "main" as a default branch name is getting more common. The
no_commit_to_branch tests depend on this being the default.
2021-03-04 13:32:47 +00:00

17 lines
296 B
Python

import pytest
from pre_commit_hooks.util import cmd_output
@pytest.fixture
def temp_git_dir(tmpdir):
git_dir = tmpdir.join('gits')
cmd_output(
'git',
'-c',
'init.defaultBranch=master',
'init',
'--',
str(git_dir),
)
yield git_dir