mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Move PrefixedCommandRunner -> Prefix
This commit is contained in:
parent
c751f629a6
commit
7d87da8acd
23 changed files with 270 additions and 372 deletions
|
|
@ -5,6 +5,7 @@ import random
|
|||
|
||||
import pytest
|
||||
|
||||
from pre_commit.util import CalledProcessError
|
||||
from pre_commit.util import clean_path_on_failure
|
||||
from pre_commit.util import cmd_output
|
||||
from pre_commit.util import cwd
|
||||
|
|
@ -12,6 +13,34 @@ from pre_commit.util import memoize_by_cwd
|
|||
from pre_commit.util import tmpdir
|
||||
|
||||
|
||||
def test_CalledProcessError_str():
|
||||
error = CalledProcessError(
|
||||
1, [str('git'), str('status')], 0, (str('stdout'), str('stderr')),
|
||||
)
|
||||
assert str(error) == (
|
||||
"Command: ['git', 'status']\n"
|
||||
"Return code: 1\n"
|
||||
"Expected return code: 0\n"
|
||||
"Output: \n"
|
||||
" stdout\n"
|
||||
"Errors: \n"
|
||||
" stderr\n"
|
||||
)
|
||||
|
||||
|
||||
def test_CalledProcessError_str_nooutput():
|
||||
error = CalledProcessError(
|
||||
1, [str('git'), str('status')], 0, (str(''), str('')),
|
||||
)
|
||||
assert str(error) == (
|
||||
"Command: ['git', 'status']\n"
|
||||
"Return code: 1\n"
|
||||
"Expected return code: 0\n"
|
||||
"Output: (none)\n"
|
||||
"Errors: (none)\n"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def memoized_by_cwd():
|
||||
@memoize_by_cwd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue