summaryrefslogtreecommitdiffstats
path: root/tests/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-11 08:29:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-11 08:29:48 +0000
commitb73378b6cdae53383ce4549f0f301ece440b2969 (patch)
tree94678c0984baae45fd0358db8309e9190b3fe362 /tests/commands
parentReleasing debian version 3.5.0-1. (diff)
downloadpre-commit-b73378b6cdae53383ce4549f0f301ece440b2969.tar.xz
pre-commit-b73378b6cdae53383ce4549f0f301ece440b2969.zip
Merging upstream version 3.6.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands')
-rw-r--r--tests/commands/install_uninstall_test.py10
-rw-r--r--tests/commands/run_test.py2
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py
index 8b0d3ec..9eb0e74 100644
--- a/tests/commands/install_uninstall_test.py
+++ b/tests/commands/install_uninstall_test.py
@@ -349,8 +349,9 @@ def test_install_existing_hooks_no_overwrite(tempdir_factory, store):
# We should run both the legacy and pre-commit hooks
ret, output = _get_commit_output(tempdir_factory)
assert ret == 0
- assert output.startswith('legacy hook\n')
- NORMAL_PRE_COMMIT_RUN.assert_matches(output[len('legacy hook\n'):])
+ legacy = 'legacy hook\n'
+ assert output.startswith(legacy)
+ NORMAL_PRE_COMMIT_RUN.assert_matches(output.removeprefix(legacy))
def test_legacy_overwriting_legacy_hook(tempdir_factory, store):
@@ -375,8 +376,9 @@ def test_install_existing_hook_no_overwrite_idempotent(tempdir_factory, store):
# We should run both the legacy and pre-commit hooks
ret, output = _get_commit_output(tempdir_factory)
assert ret == 0
- assert output.startswith('legacy hook\n')
- NORMAL_PRE_COMMIT_RUN.assert_matches(output[len('legacy hook\n'):])
+ legacy = 'legacy hook\n'
+ assert output.startswith(legacy)
+ NORMAL_PRE_COMMIT_RUN.assert_matches(output.removeprefix(legacy))
def test_install_with_existing_non_utf8_script(tmpdir, store):
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index 6a0cd85..e36a3ca 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -4,7 +4,7 @@ import os.path
import shlex
import sys
import time
-from typing import MutableMapping
+from collections.abc import MutableMapping
from unittest import mock
import pytest