mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge branch 'master' into meta-hooks
This commit is contained in:
commit
bc9344bb40
6 changed files with 73 additions and 127 deletions
|
|
@ -71,6 +71,16 @@ def test_python_hook(tempdir_factory, store):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_python_hook_default_version(tempdir_factory, store):
|
||||
# make sure that this continues to work for platforms where default
|
||||
# language detection does not work
|
||||
with mock.patch.object(
|
||||
python, 'get_default_version', return_value='default',
|
||||
):
|
||||
test_python_hook(tempdir_factory, store)
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_python_hook_args_with_spaces(tempdir_factory, store):
|
||||
_test_hook_repo(
|
||||
|
|
@ -690,6 +700,8 @@ def test_local_python_repo(store):
|
|||
config = {'repo': 'local', 'hooks': hooks}
|
||||
repo = Repository.create(config, store)
|
||||
(_, hook), = repo.hooks
|
||||
# language_version should have been adjusted to the interpreter version
|
||||
assert hook['language_version'] != 'default'
|
||||
ret = repo.run_hook(hook, ('filename',))
|
||||
assert ret[0] == 0
|
||||
assert _norm_out(ret[1]) == b"['filename']\nHello World\n"
|
||||
|
|
@ -746,3 +758,29 @@ def test_versions_ok(tempdir_factory, store, version):
|
|||
config = make_config_from_repo(path)
|
||||
# Should succeed
|
||||
Repository.create(config, store).require_installed()
|
||||
|
||||
|
||||
def test_manifest_hooks(tempdir_factory, store):
|
||||
path = make_repo(tempdir_factory, 'script_hooks_repo')
|
||||
config = make_config_from_repo(path)
|
||||
repo = Repository.create(config, store)
|
||||
|
||||
assert repo.manifest_hooks['bash_hook'] == {
|
||||
'always_run': False,
|
||||
'additional_dependencies': [],
|
||||
'args': [],
|
||||
'description': '',
|
||||
'entry': 'bin/hook.sh',
|
||||
'exclude': '^$',
|
||||
'files': '',
|
||||
'id': 'bash_hook',
|
||||
'language': 'script',
|
||||
'language_version': 'default',
|
||||
'log_file': '',
|
||||
'minimum_pre_commit_version': '0',
|
||||
'name': 'Bash hook',
|
||||
'pass_filenames': True,
|
||||
'stages': [],
|
||||
'types': ['file'],
|
||||
'exclude_types': [],
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue