MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / test_hook_id_not_present

Function test_hook_id_not_present

tests/repository_test.py:395–406  ·  view source on GitHub ↗
(tempdir_factory, store, caplog)

Source from the content-addressed store, hash-verified

393
394
395def test_hook_id_not_present(tempdir_factory, store, caplog):
396 path = make_repo(tempdir_factory, 'script_hooks_repo')
397 config = make_config_from_repo(path)
398 config['hooks'][0]['id'] = 'i-dont-exist'
399 with pytest.raises(SystemExit):
400 _get_hook(config, store, 'i-dont-exist')
401 _, msg = caplog.messages
402 assert msg == (
403 f'`i-dont-exist` is not present in repository file://{path}. '
404 f'Typo? Perhaps it is introduced in a newer version? '
405 f'Often `pre-commit autoupdate` fixes this.'
406 )
407
408
409def test_manifest_hooks(tempdir_factory, store):

Callers

nothing calls this directly

Calls 3

make_repoFunction · 0.90
make_config_from_repoFunction · 0.90
_get_hookFunction · 0.85

Tested by

no test coverage detected