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

Function test_global_files

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

Source from the content-addressed store, hash-verified

266
267
268def test_global_files(cap_out, store, in_git_dir):
269 config = {
270 'files': r'^bar\.py$',
271 'repos': [{'repo': 'meta', 'hooks': [{'id': 'identity'}]}],
272 }
273 write_config('.', config)
274 open('foo.py', 'a').close()
275 open('bar.py', 'a').close()
276 cmd_output('git', 'add', '.')
277 opts = run_opts(verbose=True)
278 ret, printed = _do_run(cap_out, store, str(in_git_dir), opts)
279 assert ret == 0
280 # Does not contain foo.py since it was excluded
281 assert printed.startswith(f'identity{"." * 65}Passed\n'.encode())
282 assert printed.endswith(b'\n\nbar.py\n\n')
283
284
285@pytest.mark.parametrize(

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