mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Merge pull request #3029 from adamchainz/improve_duration_timing
Improve hook duration timing
This commit is contained in:
commit
c9945b9aa3
3 changed files with 4 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 == ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue