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

Function test_run_output_logfile

tests/commands/run_test.py:402–424  ·  view source on GitHub ↗
(cap_out, store, tempdir_factory)

Source from the content-addressed store, hash-verified

400
401
402def test_run_output_logfile(cap_out, store, tempdir_factory):
403 expected_output = (
404 b'This is STDOUT output\n',
405 b'This is STDERR output\n',
406 )
407
408 git_path = make_consuming_repo(tempdir_factory, 'logfile_repo')
409 with cwd(git_path):
410 _test_run(
411 cap_out,
412 store,
413 git_path, {},
414 expected_output,
415 expected_ret=1,
416 stage=True,
417 )
418 logfile_path = os.path.join(git_path, 'test.log')
419 assert os.path.exists(logfile_path)
420 with open(logfile_path, 'rb') as logfile:
421 logfile_content = logfile.readlines()
422
423 for expected_output_part in expected_output:
424 assert expected_output_part in logfile_content
425
426
427def test_always_run(cap_out, store, repo_with_passing_hook):

Callers

nothing calls this directly

Calls 4

make_consuming_repoFunction · 0.90
cwdFunction · 0.90
_test_runFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected