mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 20:16:53 +00:00
Apply typing to all of pre-commit-hooks
This commit is contained in:
parent
63cc3414e9
commit
030bfac7e4
54 changed files with 401 additions and 264 deletions
|
|
@ -2,7 +2,7 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
from pre_commit_hooks.check_symlinks import check_symlinks
|
||||
from pre_commit_hooks.check_symlinks import main
|
||||
|
||||
|
||||
xfail_symlink = pytest.mark.xfail(os.name == 'nt', reason='No symlink support')
|
||||
|
|
@ -12,12 +12,12 @@ xfail_symlink = pytest.mark.xfail(os.name == 'nt', reason='No symlink support')
|
|||
@pytest.mark.parametrize(
|
||||
('dest', 'expected'), (('exists', 0), ('does-not-exist', 1)),
|
||||
)
|
||||
def test_check_symlinks(tmpdir, dest, expected): # pragma: no cover (symlinks)
|
||||
def test_main(tmpdir, dest, expected): # pragma: no cover (symlinks)
|
||||
tmpdir.join('exists').ensure()
|
||||
symlink = tmpdir.join('symlink')
|
||||
symlink.mksymlinkto(tmpdir.join(dest))
|
||||
assert check_symlinks((symlink.strpath,)) == expected
|
||||
assert main((symlink.strpath,)) == expected
|
||||
|
||||
|
||||
def test_check_symlinks_normal_file(tmpdir):
|
||||
assert check_symlinks((tmpdir.join('f').ensure().strpath,)) == 0
|
||||
def test_main_normal_file(tmpdir):
|
||||
assert main((tmpdir.join('f').ensure().strpath,)) == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue