mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Change cmd_output_bs retcode arg to a boolean check
This commit is contained in:
parent
71925c47ea
commit
84b38f7b89
15 changed files with 28 additions and 26 deletions
|
|
@ -83,14 +83,14 @@ def test_tmpdir():
|
|||
|
||||
|
||||
def test_cmd_output_exe_not_found():
|
||||
ret, out, _ = cmd_output('dne', retcode=None)
|
||||
ret, out, _ = cmd_output('dne', check=False)
|
||||
assert ret == 1
|
||||
assert out == 'Executable `dne` not found'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fn', (cmd_output_b, cmd_output_p))
|
||||
def test_cmd_output_exe_not_found_bytes(fn):
|
||||
ret, out, _ = fn('dne', retcode=None, stderr=subprocess.STDOUT)
|
||||
ret, out, _ = fn('dne', check=False, stderr=subprocess.STDOUT)
|
||||
assert ret == 1
|
||||
assert out == b'Executable `dne` not found'
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ def test_cmd_output_no_shebang(tmpdir, fn):
|
|||
make_executable(f)
|
||||
|
||||
# previously this raised `OSError` -- the output is platform specific
|
||||
ret, out, _ = fn(str(f), retcode=None, stderr=subprocess.STDOUT)
|
||||
ret, out, _ = fn(str(f), check=False, stderr=subprocess.STDOUT)
|
||||
assert ret == 1
|
||||
assert isinstance(out, bytes)
|
||||
assert out.endswith(b'\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue