Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b31cb22

Browse files
authored
Merge pull request #902 from pre-commit/windows_100
Add more 'no cover windows' comments
2 parents 177164b + 4f9d039 commit b31cb22

6 files changed

Lines changed: 24 additions & 10 deletions

File tree

pre_commit/commands/install_uninstall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _hook_paths(hook_type):
3939

4040

4141
def is_our_script(filename):
42-
if not os.path.exists(filename):
42+
if not os.path.exists(filename): # pragma: windows no cover (symlink)
4343
return False
4444
with io.open(filename) as f:
4545
contents = f.read()

pre_commit/languages/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def install_environment(
7272
os.mkdir(directory)
7373

7474

75-
def docker_cmd():
75+
def docker_cmd(): # pragma: windows no cover
7676
return (
7777
'docker', 'run',
7878
'--rm',

tests/languages/helpers_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def test_failed_setup_command_does_not_unicode_error():
3434
helpers.run_setup_cmd(Prefix('.'), (sys.executable, '-c', script))
3535

3636

37+
def test_assert_no_additional_deps():
38+
with pytest.raises(AssertionError) as excinfo:
39+
helpers.assert_no_additional_deps('lang', ['hmmm'])
40+
msg, = excinfo.value.args
41+
assert msg == (
42+
'For now, pre-commit does not support additional_dependencies for lang'
43+
)
44+
45+
3746
SERIAL_FALSE = auto_namedtuple(require_serial=False)
3847
SERIAL_TRUE = auto_namedtuple(require_serial=True)
3948

tests/prefix_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ def test_exists(tmpdir):
3838
assert not Prefix(str(tmpdir)).exists('foo')
3939
tmpdir.ensure('foo')
4040
assert Prefix(str(tmpdir)).exists('foo')
41+
42+
43+
def test_star(tmpdir):
44+
for f in ('a.txt', 'b.txt', 'c.py'):
45+
tmpdir.join(f).ensure()
46+
assert set(Prefix(str(tmpdir)).star('.txt')) == {'a.txt', 'b.txt'}

tests/repository_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_versioned_python_hook(tempdir_factory, store):
141141
)
142142

143143

144-
@skipif_cant_run_docker
144+
@skipif_cant_run_docker # pragma: windows no cover
145145
def test_run_a_docker_hook(tempdir_factory, store):
146146
_test_hook_repo(
147147
tempdir_factory, store, 'docker_hooks_repo',
@@ -150,7 +150,7 @@ def test_run_a_docker_hook(tempdir_factory, store):
150150
)
151151

152152

153-
@skipif_cant_run_docker
153+
@skipif_cant_run_docker # pragma: windows no cover
154154
def test_run_a_docker_hook_with_entry_args(tempdir_factory, store):
155155
_test_hook_repo(
156156
tempdir_factory, store, 'docker_hooks_repo',
@@ -159,7 +159,7 @@ def test_run_a_docker_hook_with_entry_args(tempdir_factory, store):
159159
)
160160

161161

162-
@skipif_cant_run_docker
162+
@skipif_cant_run_docker # pragma: windows no cover
163163
def test_run_a_failing_docker_hook(tempdir_factory, store):
164164
_test_hook_repo(
165165
tempdir_factory, store, 'docker_hooks_repo',
@@ -169,7 +169,7 @@ def test_run_a_failing_docker_hook(tempdir_factory, store):
169169
)
170170

171171

172-
@skipif_cant_run_docker
172+
@skipif_cant_run_docker # pragma: windows no cover
173173
@pytest.mark.parametrize('hook_id', ('echo-entrypoint', 'echo-cmd'))
174174
def test_run_a_docker_image_hook(tempdir_factory, store, hook_id):
175175
_test_hook_repo(
@@ -242,7 +242,7 @@ def test_system_hook_with_spaces(tempdir_factory, store):
242242
)
243243

244244

245-
@skipif_cant_run_swift
245+
@skipif_cant_run_swift # pragma: windows no cover
246246
def test_swift_hook(tempdir_factory, store):
247247
_test_hook_repo(
248248
tempdir_factory, store, 'swift_hooks_repo',
@@ -386,7 +386,7 @@ def test_grep_hook_not_matching(self, regex, greppable_files, store):
386386
assert (ret, out) == (0, b'')
387387

388388

389-
@xfailif_no_pcre_support
389+
@xfailif_no_pcre_support # pragma: windows no cover
390390
class TestPCRE(TestPygrep):
391391
"""organized as a class for xfailing pcre"""
392392
language = 'pcre'

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ passenv = GOROOT HOME HOMEPATH PROGRAMDATA TERM
99
commands =
1010
coverage erase
1111
coverage run -m pytest {posargs:tests}
12-
# TODO: change to 100
13-
coverage report --fail-under 99
12+
coverage report --fail-under 100
1413
pre-commit run --all-files
1514

1615
[testenv:venv]

0 commit comments

Comments
 (0)