mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1345 from pre-commit/fix_coverage
Fix test coverage
This commit is contained in:
commit
5e21e0bec6
1 changed files with 22 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ from pre_commit.util import EnvironT
|
||||||
from pre_commit.util import make_executable
|
from pre_commit.util import make_executable
|
||||||
from testing.auto_namedtuple import auto_namedtuple
|
from testing.auto_namedtuple import auto_namedtuple
|
||||||
from testing.fixtures import add_config_to_repo
|
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 make_consuming_repo
|
||||||
from testing.fixtures import modify_config
|
from testing.fixtures import modify_config
|
||||||
from testing.fixtures import read_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):
|
def test_prepare_commit_msg_hook(cap_out, store, prepare_commit_msg_repo):
|
||||||
filename = '.git/COMMIT_EDITMSG'
|
filename = '.git/COMMIT_EDITMSG'
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue