From 1b93e26b5829165d12a13dee3aa1df3fbb33642e Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sun, 23 Feb 2020 14:53:03 -0800 Subject: [PATCH] Fix test coverage --- tests/commands/run_test.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py index 63129ff5..f8e88236 100644 --- a/tests/commands/run_test.py +++ b/tests/commands/run_test.py @@ -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: