summaryrefslogtreecommitdiffstats
path: root/tests/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-16 11:14:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-10-16 11:14:57 +0000
commitbdd97c38eaba207665d85bc1ad63341337f41ac6 (patch)
tree2b4ae82c13c4910fd431b44f17532d78deb375b8 /tests/commands
parentReleasing debian version 3.4.0-1. (diff)
downloadpre-commit-bdd97c38eaba207665d85bc1ad63341337f41ac6.tar.xz
pre-commit-bdd97c38eaba207665d85bc1ad63341337f41ac6.zip
Merging upstream version 3.5.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands')
-rw-r--r--tests/commands/run_test.py18
-rw-r--r--tests/commands/try_repo_test.py2
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index dd15b94..6a0cd85 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -293,7 +293,7 @@ def test_verbose_duration(cap_out, store, in_git_dir, t1, t2, expected):
write_config('.', {'repo': 'meta', 'hooks': [{'id': 'identity'}]})
cmd_output('git', 'add', '.')
opts = run_opts(verbose=True)
- with mock.patch.object(time, 'time', side_effect=(t1, t2)):
+ with mock.patch.object(time, 'monotonic', side_effect=(t1, t2)):
ret, printed = _do_run(cap_out, store, str(in_git_dir), opts)
assert ret == 0
assert expected in printed
@@ -1127,8 +1127,8 @@ def test_classifier_empty_types_or(tmpdir):
types_or=[],
exclude_types=[],
)
- assert for_symlink == ['foo']
- assert for_file == ['bar']
+ assert tuple(for_symlink) == ('foo',)
+ assert tuple(for_file) == ('bar',)
@pytest.fixture
@@ -1142,33 +1142,33 @@ def some_filenames():
def test_include_exclude_base_case(some_filenames):
ret = filter_by_include_exclude(some_filenames, '', '^$')
- assert ret == [
+ assert tuple(ret) == (
'.pre-commit-hooks.yaml',
'pre_commit/git.py',
'pre_commit/main.py',
- ]
+ )
def test_matches_broken_symlink(tmpdir):
with tmpdir.as_cwd():
os.symlink('does-not-exist', 'link')
ret = filter_by_include_exclude({'link'}, '', '^$')
- assert ret == ['link']
+ assert tuple(ret) == ('link',)
def test_include_exclude_total_match(some_filenames):
ret = filter_by_include_exclude(some_filenames, r'^.*\.py$', '^$')
- assert ret == ['pre_commit/git.py', 'pre_commit/main.py']
+ assert tuple(ret) == ('pre_commit/git.py', 'pre_commit/main.py')
def test_include_exclude_does_search_instead_of_match(some_filenames):
ret = filter_by_include_exclude(some_filenames, r'\.yaml$', '^$')
- assert ret == ['.pre-commit-hooks.yaml']
+ assert tuple(ret) == ('.pre-commit-hooks.yaml',)
def test_include_exclude_exclude_removes_files(some_filenames):
ret = filter_by_include_exclude(some_filenames, '', r'\.py$')
- assert ret == ['.pre-commit-hooks.yaml']
+ assert tuple(ret) == ('.pre-commit-hooks.yaml',)
def test_args_hook_only(cap_out, store, repo_with_passing_hook):
diff --git a/tests/commands/try_repo_test.py b/tests/commands/try_repo_test.py
index 0b2db7e..c5f891e 100644
--- a/tests/commands/try_repo_test.py
+++ b/tests/commands/try_repo_test.py
@@ -43,7 +43,7 @@ def _run_try_repo(tempdir_factory, **kwargs):
def test_try_repo_repo_only(cap_out, tempdir_factory):
- with mock.patch.object(time, 'time', return_value=0.0):
+ with mock.patch.object(time, 'monotonic', return_value=0.0):
_run_try_repo(tempdir_factory, verbose=True)
start, config, rest = _get_out(cap_out)
assert start == ''