Fix test coverage

This commit is contained in:
Anthony Sottile
2020-02-23 14:53:03 -08:00
parent 92f433c3cf
commit 1b93e26b58

View File

@@ -22,6 +22,7 @@ from pre_commit.util import EnvironT
from pre_commit.util import make_executable
from testing.auto_namedtuple import auto_namedtuple
from testing.fixtures import add_config_to_repo
from testing.fixtures import git_dir
from testing.fixtures import make_consuming_repo
from testing.fixtures import modify_config
from testing.fixtures import read_config
@@ -709,6 +710,27 @@ def test_commit_msg_hook(cap_out, store, commit_msg_repo):
)
def test_post_checkout_hook(cap_out, store, tempdir_factory):
path = git_dir(tempdir_factory)
config = {
'repo': 'meta', 'hooks': [
{'id': 'identity', 'stages': ['post-checkout']},
],
}
add_config_to_repo(path, config)
with cwd(path):
_test_run(
cap_out,
store,
path,
{'hook_stage': 'post-checkout'},
expected_outputs=[b'identity...'],
expected_ret=0,
stage=False,
)
def test_prepare_commit_msg_hook(cap_out, store, prepare_commit_msg_repo):
filename = '.git/COMMIT_EDITMSG'
with open(filename, 'w') as f: