mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-30 02:16:52 +00:00
Fix asymptomatic copy/paste bug in test.
check_shebang_scripts_are_executable_test.test_git_executable_shebang manually filtered executable files out before calling check_shebang_scripts_are_executable. This makes sense in check_executables_have_shebangs.test_git_executable_shebang, because the check-executables-have-shebangs hook only runs on executable files. However, check-shebang-scripts-are-executable correctly runs on all text files, so the test shouldn't filter executable files out. The test still passed because when git ls-files is passed no files in particular, it lists all files in the Git repository that satisfy the given filters.
This commit is contained in:
parent
08792de8d1
commit
9245e07a3e
1 changed files with 2 additions and 6 deletions
|
|
@ -1,7 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit_hooks.check_shebang_scripts_are_executable import \
|
||||
|
|
@ -83,7 +81,5 @@ def test_git_executable_shebang(temp_git_dir, content, mode, expected):
|
|||
cmd_output('chmod', mode, str(path))
|
||||
cmd_output('git', 'update-index', f'--chmod={mode}', str(path))
|
||||
|
||||
# simulate how identify chooses that something is executable
|
||||
filenames = [path for path in [str(path)] if os.access(path, os.X_OK)]
|
||||
|
||||
assert main(filenames) == expected
|
||||
files = (str(path),)
|
||||
assert main(files) == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue