Merge pull request #2767 from pre-commit/test-more-directly · hack3ric/pre-commit@4f6ba18 · GitHub
Skip to content

Commit 4f6ba18

Browse files
authored
Merge pull request pre-commit#2767 from pre-commit/test-more-directly
test things more directly to improve coverage
2 parents c3402e6 + c3613b9 commit 4f6ba18

4 files changed

Lines changed: 46 additions & 16 deletions

File tree

tests/languages/python_test.py

Lines changed: 23 additions & 0 deletions

tests/languages/script_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 script
4+
from pre_commit.util import make_executable
5+
from testing.language_helpers import run_language
6+
7+
8+
def test_script_language(tmp_path):
9+
exe = tmp_path.joinpath('main')
10+
exe.write_text('#!/usr/bin/env bash\necho hello hello world\n')
11+
make_executable(exe)
12+
13+
expected = (0, b'hello hello world\n')
14+
assert run_language(tmp_path, script, 'main') == expected

tests/languages/system_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import annotations
2+
3+
from pre_commit.languages import system
4+
from testing.language_helpers import run_language
5+
6+
7+
def test_system_language(tmp_path):
8+
expected = (0, b'hello hello world\n')
9+
assert run_language(tmp_path, system, 'echo hello hello world') == expected

tests/repository_test.py

Lines changed: 0 additions & 16 deletions

0 commit comments

Comments
 (0)