forked from pre-commit/pre-commit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pre-commit#2767 from pre-commit/test-more-directly
test things more directly to improve coverage
- Loading branch information
Showing
4 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from __future__ import annotations | ||
|
||
from pre_commit.languages import script | ||
from pre_commit.util import make_executable | ||
from testing.language_helpers import run_language | ||
|
||
|
||
def test_script_language(tmp_path): | ||
exe = tmp_path.joinpath('main') | ||
exe.write_text('#!/usr/bin/env bash\necho hello hello world\n') | ||
make_executable(exe) | ||
|
||
expected = (0, b'hello hello world\n') | ||
assert run_language(tmp_path, script, 'main') == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from __future__ import annotations | ||
|
||
from pre_commit.languages import system | ||
from testing.language_helpers import run_language | ||
|
||
|
||
def test_system_language(tmp_path): | ||
expected = (0, b'hello hello world\n') | ||
assert run_language(tmp_path, system, 'echo hello hello world') == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters