1 parent 4bd1677 commit 4fdfb25Copy full SHA for 4fdfb25
2 files changed
tests/languages/fail_test.py
@@ -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
@@ -330,30 +330,6 @@ def test_repository_state_compatibility(tempdir_factory, store, v):
330
assert _hook_installed(hook) is True
331
332
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
357
def test_unknown_keys(store, caplog):
358
config = {
359
'repo': 'local',
0 commit comments