mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
fix trailing whitespace in CalledProcessError output
This commit is contained in:
parent
192be6079b
commit
4ded56efac
3 changed files with 3 additions and 5 deletions
|
|
@ -62,7 +62,7 @@ class CalledProcessError(RuntimeError):
|
||||||
def __bytes__(self) -> bytes:
|
def __bytes__(self) -> bytes:
|
||||||
def _indent_or_none(part: bytes | None) -> bytes:
|
def _indent_or_none(part: bytes | None) -> bytes:
|
||||||
if part:
|
if part:
|
||||||
return b'\n ' + part.replace(b'\n', b'\n ')
|
return b'\n ' + part.replace(b'\n', b'\n ').rstrip()
|
||||||
else:
|
else:
|
||||||
return b' (none)'
|
return b' (none)'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -425,9 +425,7 @@ def test_failed_diff_does_not_discard_changes(in_git_dir, patch_dir):
|
||||||
r'stdout: \(none\)\n'
|
r'stdout: \(none\)\n'
|
||||||
r'stderr:\n'
|
r'stderr:\n'
|
||||||
r' error: open\("1"\): Permission denied\n'
|
r' error: open\("1"\): Permission denied\n'
|
||||||
r' fatal: cannot hash 1\n'
|
r' fatal: cannot hash 1$',
|
||||||
# TODO: not sure why there's weird whitespace here
|
|
||||||
r' $',
|
|
||||||
).assert_matches(msg)
|
).assert_matches(msg)
|
||||||
|
|
||||||
# even though it errored, the unstaged changes should still be present
|
# even though it errored, the unstaged changes should still be present
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from pre_commit.util import rmtree
|
||||||
|
|
||||||
|
|
||||||
def test_CalledProcessError_str():
|
def test_CalledProcessError_str():
|
||||||
error = CalledProcessError(1, ('exe',), b'output', b'errors')
|
error = CalledProcessError(1, ('exe',), b'output\n', b'errors\n')
|
||||||
assert str(error) == (
|
assert str(error) == (
|
||||||
"command: ('exe',)\n"
|
"command: ('exe',)\n"
|
||||||
'return code: 1\n'
|
'return code: 1\n'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue