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

Skip to content

Commit 4fdfb25

Browse files
committed
test fail language inline
1 parent 4bd1677 commit 4fdfb25

2 files changed

Lines changed: 14 additions & 24 deletions

File tree

tests/languages/fail_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from __future__ import annotations
2+
3+
from pre_commit.languages import fail
4+
from testing.language_helpers import run_language
5+
6+
7+
def test_fail_hooks(tmp_path):
8+
ret = run_language(
9+
tmp_path,
10+
fail,
11+
'watch out for',
12+
file_args=('bunnies',),
13+
)
14+
assert ret == (1, b'watch out for\n\nbunnies\n')

tests/repository_test.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -330,30 +330,6 @@ def test_repository_state_compatibility(tempdir_factory, store, v):
330330
assert _hook_installed(hook) is True
331331

332332

333-
def test_fail_hooks(store):
334-
config = {
335-
'repo': 'local',
336-
'hooks': [{
337-
'id': 'fail',
338-
'name': 'fail',
339-
'language': 'fail',
340-
'entry': 'make sure to name changelogs as .rst!',
341-
'files': r'changelog/.*(?<!\.rst)$',
342-
}],
343-
}
344-
hook = _get_hook(config, store, 'fail')
345-
ret, out = _hook_run(
346-
hook, ('changelog/123.bugfix', 'changelog/wat'), color=False,
347-
)
348-
assert ret == 1
349-
assert out == (
350-
b'make sure to name changelogs as .rst!\n'
351-
b'\n'
352-
b'changelog/123.bugfix\n'
353-
b'changelog/wat\n'
354-
)
355-
356-
357333
def test_unknown_keys(store, caplog):
358334
config = {
359335
'repo': 'local',

0 commit comments

Comments
 (0)