1
0
Fork 0

Merging upstream version 4.0.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 21:51:43 +01:00
parent 06469805a5
commit 0b6981c15c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
44 changed files with 596 additions and 105 deletions

View file

@ -80,24 +80,6 @@ def _test_hook_repo(
assert out == expected
def test_python_venv_deprecation(store, caplog):
config = {
'repo': 'local',
'hooks': [{
'id': 'example',
'name': 'example',
'language': 'python_venv',
'entry': 'echo hi',
}],
}
_get_hook(config, store, 'example')
assert caplog.messages[-1] == (
'`repo: local` uses deprecated `language: python_venv`. '
'This is an alias for `language: python`. '
'Often `pre-commit autoupdate --repo local` will fix this.'
)
def test_system_hook_with_spaces(tempdir_factory, store):
_test_hook_repo(
tempdir_factory, store, 'system_hook_with_spaces_repo',
@ -240,16 +222,16 @@ def test_unknown_keys(store, caplog):
assert msg == 'Unexpected key(s) present on local => too-much: foo, hello'
def test_reinstall(tempdir_factory, store, log_info_mock):
def test_reinstall(tempdir_factory, store, caplog):
path = make_repo(tempdir_factory, 'python_hooks_repo')
config = make_config_from_repo(path)
_get_hook(config, store, 'foo')
# We print some logging during clone (1) + install (3)
assert log_info_mock.call_count == 4
log_info_mock.reset_mock()
assert len(caplog.record_tuples) == 4
caplog.clear()
# Reinstall on another run should not trigger another install
_get_hook(config, store, 'foo')
assert log_info_mock.call_count == 0
assert len(caplog.record_tuples) == 0
def test_control_c_control_c_on_install(tempdir_factory, store):