Adding upstream version 3.5.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
0db83eaf7b
commit
3e8db4df26
14 changed files with 130 additions and 106 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
|
||||
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue