mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-27 03:18:39 -06:00
Implement global exclude
This commit is contained in:
@@ -183,6 +183,21 @@ def test_exclude_types_hook_repository(
|
||||
assert b'exe' not in printed
|
||||
|
||||
|
||||
def test_global_exclude(cap_out, tempdir_factory, mock_out_store_directory):
|
||||
git_path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
|
||||
with cwd(git_path):
|
||||
with modify_config() as config:
|
||||
config['exclude'] = '^foo.py$'
|
||||
open('foo.py', 'a').close()
|
||||
open('bar.py', 'a').close()
|
||||
cmd_output('git', 'add', '.')
|
||||
ret, printed = _do_run(cap_out, git_path, _get_opts(verbose=True))
|
||||
assert ret == 0
|
||||
# Does not contain foo.py since it was excluded
|
||||
expected = b'hookid: bash_hook\n\nbar.py\nHello World\n\n'
|
||||
assert printed.endswith(expected)
|
||||
|
||||
|
||||
def test_show_diff_on_failure(
|
||||
capfd, cap_out, tempdir_factory, mock_out_store_directory,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user