diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index 95488b52..d060e186 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -190,7 +190,7 @@ def _compute_cols(hooks, verbose): def _all_filenames(args): if args.origin and args.source: return git.get_changed_files(args.origin, args.source) - elif args.hook_stage in ['prepare-commit-msg', 'commit-msg']: + elif args.hook_stage in {'prepare-commit-msg', 'commit-msg'}: return (args.commit_msg_filename,) elif args.files: return args.files diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py index a216bd5a..e253dd4b 100644 --- a/tests/commands/install_uninstall_test.py +++ b/tests/commands/install_uninstall_test.py @@ -678,7 +678,7 @@ def test_prepare_commit_msg_integration_passing( commit_msg_path = os.path.join( prepare_commit_msg_repo, '.git/COMMIT_EDITMSG', ) - with io.open(commit_msg_path, 'rt') as f: + with io.open(commit_msg_path) as f: assert 'Signed off by: ' in f.read() @@ -709,7 +709,7 @@ def test_prepare_commit_msg_legacy( commit_msg_path = os.path.join( prepare_commit_msg_repo, '.git/COMMIT_EDITMSG', ) - with io.open(commit_msg_path, 'rt') as f: + with io.open(commit_msg_path) as f: assert 'Signed off by: ' in f.read() diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py index 29534648..b465cae6 100644 --- a/tests/commands/run_test.py +++ b/tests/commands/run_test.py @@ -615,7 +615,7 @@ def test_prepare_commit_msg_hook(cap_out, store, prepare_commit_msg_repo): stage=False, ) - with io.open(filename, 'rt') as f: + with io.open(filename) as f: assert 'Signed off by: ' in f.read() diff --git a/tests/conftest.py b/tests/conftest.py index e6d7777e..23ff7460 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -171,7 +171,7 @@ def failing_prepare_commit_msg_repo(tempdir_factory): 'hooks': [{ 'id': 'add-signoff', 'name': 'Add "Signed off by:"', - 'entry': '/usr/bin/env bash -c "exit 1"', + 'entry': 'bash -c "exit 1"', 'language': 'system', 'stages': ['prepare-commit-msg'], }],