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

Function test_global_exclude

tests/commands/run_test.py:251–265  ·  view source on GitHub ↗
(cap_out, store, in_git_dir)

Source from the content-addressed store, hash-verified

249
250
251def test_global_exclude(cap_out, store, in_git_dir):
252 config = {
253 'exclude': r'^foo\.py$',
254 'repos': [{'repo': 'meta', 'hooks': [{'id': 'identity'}]}],
255 }
256 write_config('.', config)
257 open('foo.py', 'a').close()
258 open('bar.py', 'a').close()
259 cmd_output('git', 'add', '.')
260 opts = run_opts(verbose=True)
261 ret, printed = _do_run(cap_out, store, str(in_git_dir), opts)
262 assert ret == 0
263 # Does not contain foo.py since it was excluded
264 assert printed.startswith(f'identity{"." * 65}Passed\n'.encode())
265 assert printed.endswith(b'\n\n.pre-commit-config.yaml\nbar.py\n\n')
266
267
268def test_global_files(cap_out, store, in_git_dir):

Callers

nothing calls this directly

Calls 4

write_configFunction · 0.90
cmd_outputFunction · 0.90
run_optsFunction · 0.90
_do_runFunction · 0.85

Tested by

no test coverage detected