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:
Kurt von Laven 2022-04-27 16:57:53 -07:00
parent 08792de8d1
commit 9245e07a3e
No known key found for this signature in database
GPG key ID: 1CDDDF4A62B85F39

View file

@ -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