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

Function test_no_textconv

tests/commands/run_test.py:779–817  ·  view source on GitHub ↗
(cap_out, store, repo_with_passing_hook)

Source from the content-addressed store, hash-verified

777
778
779def test_no_textconv(cap_out, store, repo_with_passing_hook):
780 # git textconv filters can hide changes from hooks
781 with open('.gitattributes', 'w') as fp:
782 fp.write('*.jpeg diff=empty\n')
783
784 with open('.git/config', 'a') as fp:
785 fp.write('[diff "empty"]\n')
786 fp.write('textconv = "true"\n')
787
788 config = {
789 'repo': 'local',
790 'hooks': [
791 {
792 'id': 'extend-jpeg',
793 'name': 'extend-jpeg',
794 'language': 'system',
795 'entry': (
796 f'{shlex.quote(sys.executable)} -c "import sys; '
797 'open(sys.argv[1], \'ab\').write(b\'\\x00\')"'
798 ),
799 'types': ['jpeg'],
800 },
801 ],
802 }
803 add_config_to_repo(repo_with_passing_hook, config)
804
805 stage_a_file('example.jpeg')
806
807 _test_run(
808 cap_out,
809 store,
810 repo_with_passing_hook,
811 {},
812 (
813 b'Failed',
814 ),
815 expected_ret=1,
816 stage=False,
817 )
818
819
820def test_stages(cap_out, store, repo_with_passing_hook):

Callers

nothing calls this directly

Calls 3

add_config_to_repoFunction · 0.90
stage_a_fileFunction · 0.85
_test_runFunction · 0.85

Tested by

no test coverage detected