diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-17 07:38:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-17 07:38:11 +0000 |
commit | d1801d1e6f670f245e0deb5edde46e1daf131c78 (patch) | |
tree | 87972441ed083bdd8ae4f511388bd4acc0a85988 /tests/commands | |
parent | Adding upstream version 2.12.1. (diff) | |
download | pre-commit-d1801d1e6f670f245e0deb5edde46e1daf131c78.tar.xz pre-commit-d1801d1e6f670f245e0deb5edde46e1daf131c78.zip |
Adding upstream version 2.13.0.upstream/2.13.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands')
-rw-r--r-- | tests/commands/run_test.py | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py index 4cd70fd..e184340 100644 --- a/tests/commands/run_test.py +++ b/tests/commands/run_test.py @@ -526,9 +526,9 @@ def test_merge_conflict(cap_out, store, in_merge_conflict): def test_merge_conflict_modified(cap_out, store, in_merge_conflict): # Touch another file so we have unstaged non-conflicting things - assert os.path.exists('dummy') - with open('dummy', 'w') as dummy_file: - dummy_file.write('bar\nbaz\n') + assert os.path.exists('placeholder') + with open('placeholder', 'w') as placeholder_file: + placeholder_file.write('bar\nbaz\n') ret, printed = _do_run(cap_out, store, in_merge_conflict, run_opts()) assert ret == 1 @@ -600,6 +600,29 @@ def test_skip_aliased_hook(cap_out, store, aliased_repo): assert printed.count(msg) == 1 +def test_skip_bypasses_installation(cap_out, store, repo_with_passing_hook): + config = { + 'repo': 'local', + 'hooks': [ + { + 'id': 'skipme', + 'name': 'skipme', + 'entry': 'skipme', + 'language': 'python', + 'additional_dependencies': ['/pre-commit-does-not-exist'], + }, + ], + } + add_config_to_repo(repo_with_passing_hook, config) + + ret, printed = _do_run( + cap_out, store, repo_with_passing_hook, + run_opts(all_files=True), + {'SKIP': 'skipme'}, + ) + assert ret == 0 + + def test_hook_id_not_in_non_verbose_output( cap_out, store, repo_with_passing_hook, ): @@ -808,9 +831,9 @@ def test_local_hook_passes(cap_out, store, repo_with_passing_hook): } add_config_to_repo(repo_with_passing_hook, config) - with open('dummy.py', 'w') as staged_file: + with open('placeholder.py', 'w') as staged_file: staged_file.write('"""TODO: something"""\n') - cmd_output('git', 'add', 'dummy.py') + cmd_output('git', 'add', 'placeholder.py') _test_run( cap_out, @@ -835,9 +858,9 @@ def test_local_hook_fails(cap_out, store, repo_with_passing_hook): } add_config_to_repo(repo_with_passing_hook, config) - with open('dummy.py', 'w') as staged_file: + with open('placeholder.py', 'w') as staged_file: staged_file.write('"""TODO: something"""\n') - cmd_output('git', 'add', 'dummy.py') + cmd_output('git', 'add', 'placeholder.py') _test_run( cap_out, |