Skip to content

Commit 5e21e0b

Browse files
authored
Merge pull request pre-commit#1345 from pre-commit/fix_coverage
Fix test coverage
2 parents 92f433c + 1b93e26 commit 5e21e0b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/commands/run_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from pre_commit.util import make_executable
2323
from testing.auto_namedtuple import auto_namedtuple
2424
from testing.fixtures import add_config_to_repo
25+
from testing.fixtures import git_dir
2526
from testing.fixtures import make_consuming_repo
2627
from testing.fixtures import modify_config
2728
from testing.fixtures import read_config
@@ -709,6 +710,27 @@ def test_commit_msg_hook(cap_out, store, commit_msg_repo):
709710
)
710711

711712

713+
def test_post_checkout_hook(cap_out, store, tempdir_factory):
714+
path = git_dir(tempdir_factory)
715+
config = {
716+
'repo': 'meta', 'hooks': [
717+
{'id': 'identity', 'stages': ['post-checkout']},
718+
],
719+
}
720+
add_config_to_repo(path, config)
721+
722+
with cwd(path):
723+
_test_run(
724+
cap_out,
725+
store,
726+
path,
727+
{'hook_stage': 'post-checkout'},
728+
expected_outputs=[b'identity...'],
729+
expected_ret=0,
730+
stage=False,
731+
)
732+
733+
712734
def test_prepare_commit_msg_hook(cap_out, store, prepare_commit_msg_repo):
713735
filename = '.git/COMMIT_EDITMSG'
714736
with open(filename, 'w') as f:

0 commit comments

Comments
 (0)