mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Merge pull request #902 from pre-commit/windows_100
Add more 'no cover windows' comments
This commit is contained in:
commit
b31cb22d8b
6 changed files with 24 additions and 10 deletions
|
|
@ -39,7 +39,7 @@ def _hook_paths(hook_type):
|
||||||
|
|
||||||
|
|
||||||
def is_our_script(filename):
|
def is_our_script(filename):
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename): # pragma: windows no cover (symlink)
|
||||||
return False
|
return False
|
||||||
with io.open(filename) as f:
|
with io.open(filename) as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ def install_environment(
|
||||||
os.mkdir(directory)
|
os.mkdir(directory)
|
||||||
|
|
||||||
|
|
||||||
def docker_cmd():
|
def docker_cmd(): # pragma: windows no cover
|
||||||
return (
|
return (
|
||||||
'docker', 'run',
|
'docker', 'run',
|
||||||
'--rm',
|
'--rm',
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,15 @@ def test_failed_setup_command_does_not_unicode_error():
|
||||||
helpers.run_setup_cmd(Prefix('.'), (sys.executable, '-c', script))
|
helpers.run_setup_cmd(Prefix('.'), (sys.executable, '-c', script))
|
||||||
|
|
||||||
|
|
||||||
|
def test_assert_no_additional_deps():
|
||||||
|
with pytest.raises(AssertionError) as excinfo:
|
||||||
|
helpers.assert_no_additional_deps('lang', ['hmmm'])
|
||||||
|
msg, = excinfo.value.args
|
||||||
|
assert msg == (
|
||||||
|
'For now, pre-commit does not support additional_dependencies for lang'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
SERIAL_FALSE = auto_namedtuple(require_serial=False)
|
SERIAL_FALSE = auto_namedtuple(require_serial=False)
|
||||||
SERIAL_TRUE = auto_namedtuple(require_serial=True)
|
SERIAL_TRUE = auto_namedtuple(require_serial=True)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,3 +38,9 @@ def test_exists(tmpdir):
|
||||||
assert not Prefix(str(tmpdir)).exists('foo')
|
assert not Prefix(str(tmpdir)).exists('foo')
|
||||||
tmpdir.ensure('foo')
|
tmpdir.ensure('foo')
|
||||||
assert Prefix(str(tmpdir)).exists('foo')
|
assert Prefix(str(tmpdir)).exists('foo')
|
||||||
|
|
||||||
|
|
||||||
|
def test_star(tmpdir):
|
||||||
|
for f in ('a.txt', 'b.txt', 'c.py'):
|
||||||
|
tmpdir.join(f).ensure()
|
||||||
|
assert set(Prefix(str(tmpdir)).star('.txt')) == {'a.txt', 'b.txt'}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ def test_versioned_python_hook(tempdir_factory, store):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@skipif_cant_run_docker
|
@skipif_cant_run_docker # pragma: windows no cover
|
||||||
def test_run_a_docker_hook(tempdir_factory, store):
|
def test_run_a_docker_hook(tempdir_factory, store):
|
||||||
_test_hook_repo(
|
_test_hook_repo(
|
||||||
tempdir_factory, store, 'docker_hooks_repo',
|
tempdir_factory, store, 'docker_hooks_repo',
|
||||||
|
|
@ -150,7 +150,7 @@ def test_run_a_docker_hook(tempdir_factory, store):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@skipif_cant_run_docker
|
@skipif_cant_run_docker # pragma: windows no cover
|
||||||
def test_run_a_docker_hook_with_entry_args(tempdir_factory, store):
|
def test_run_a_docker_hook_with_entry_args(tempdir_factory, store):
|
||||||
_test_hook_repo(
|
_test_hook_repo(
|
||||||
tempdir_factory, store, 'docker_hooks_repo',
|
tempdir_factory, store, 'docker_hooks_repo',
|
||||||
|
|
@ -159,7 +159,7 @@ def test_run_a_docker_hook_with_entry_args(tempdir_factory, store):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@skipif_cant_run_docker
|
@skipif_cant_run_docker # pragma: windows no cover
|
||||||
def test_run_a_failing_docker_hook(tempdir_factory, store):
|
def test_run_a_failing_docker_hook(tempdir_factory, store):
|
||||||
_test_hook_repo(
|
_test_hook_repo(
|
||||||
tempdir_factory, store, 'docker_hooks_repo',
|
tempdir_factory, store, 'docker_hooks_repo',
|
||||||
|
|
@ -169,7 +169,7 @@ def test_run_a_failing_docker_hook(tempdir_factory, store):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@skipif_cant_run_docker
|
@skipif_cant_run_docker # pragma: windows no cover
|
||||||
@pytest.mark.parametrize('hook_id', ('echo-entrypoint', 'echo-cmd'))
|
@pytest.mark.parametrize('hook_id', ('echo-entrypoint', 'echo-cmd'))
|
||||||
def test_run_a_docker_image_hook(tempdir_factory, store, hook_id):
|
def test_run_a_docker_image_hook(tempdir_factory, store, hook_id):
|
||||||
_test_hook_repo(
|
_test_hook_repo(
|
||||||
|
|
@ -242,7 +242,7 @@ def test_system_hook_with_spaces(tempdir_factory, store):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@skipif_cant_run_swift
|
@skipif_cant_run_swift # pragma: windows no cover
|
||||||
def test_swift_hook(tempdir_factory, store):
|
def test_swift_hook(tempdir_factory, store):
|
||||||
_test_hook_repo(
|
_test_hook_repo(
|
||||||
tempdir_factory, store, 'swift_hooks_repo',
|
tempdir_factory, store, 'swift_hooks_repo',
|
||||||
|
|
@ -386,7 +386,7 @@ class TestPygrep(object):
|
||||||
assert (ret, out) == (0, b'')
|
assert (ret, out) == (0, b'')
|
||||||
|
|
||||||
|
|
||||||
@xfailif_no_pcre_support
|
@xfailif_no_pcre_support # pragma: windows no cover
|
||||||
class TestPCRE(TestPygrep):
|
class TestPCRE(TestPygrep):
|
||||||
"""organized as a class for xfailing pcre"""
|
"""organized as a class for xfailing pcre"""
|
||||||
language = 'pcre'
|
language = 'pcre'
|
||||||
|
|
|
||||||
3
tox.ini
3
tox.ini
|
|
@ -9,8 +9,7 @@ passenv = GOROOT HOME HOMEPATH PROGRAMDATA TERM
|
||||||
commands =
|
commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run -m pytest {posargs:tests}
|
coverage run -m pytest {posargs:tests}
|
||||||
# TODO: change to 100
|
coverage report --fail-under 100
|
||||||
coverage report --fail-under 99
|
|
||||||
pre-commit run --all-files
|
pre-commit run --all-files
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue