(cap_out, store, repo_with_passing_hook)
| 910 | |
| 911 | |
| 912 | def test_local_hook_passes(cap_out, store, repo_with_passing_hook): |
| 913 | config = { |
| 914 | 'repo': 'local', |
| 915 | 'hooks': [ |
| 916 | { |
| 917 | 'id': 'identity-copy', |
| 918 | 'name': 'identity-copy', |
| 919 | 'entry': '{} -m pre_commit.meta_hooks.identity'.format( |
| 920 | shlex.quote(sys.executable), |
| 921 | ), |
| 922 | 'language': 'system', |
| 923 | 'files': r'\.py$', |
| 924 | }, |
| 925 | { |
| 926 | 'id': 'do_not_commit', |
| 927 | 'name': 'Block if "DO NOT COMMIT" is found', |
| 928 | 'entry': 'DO NOT COMMIT', |
| 929 | 'language': 'pygrep', |
| 930 | }, |
| 931 | ], |
| 932 | } |
| 933 | add_config_to_repo(repo_with_passing_hook, config) |
| 934 | |
| 935 | with open('placeholder.py', 'w') as staged_file: |
| 936 | staged_file.write('"""TODO: something"""\n') |
| 937 | cmd_output('git', 'add', 'placeholder.py') |
| 938 | |
| 939 | _test_run( |
| 940 | cap_out, |
| 941 | store, |
| 942 | repo_with_passing_hook, |
| 943 | opts={}, |
| 944 | expected_outputs=[b''], |
| 945 | expected_ret=0, |
| 946 | stage=False, |
| 947 | ) |
| 948 | |
| 949 | |
| 950 | def test_local_hook_fails(cap_out, store, repo_with_passing_hook): |
nothing calls this directly
no test coverage detected