summaryrefslogtreecommitdiffstats
path: root/tests/util_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-04 07:22:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-04 07:22:28 +0000
commit2e8bfde15d76ad56da2d1bbd99294dafd4e4372f (patch)
tree8baa02378416532628cbe6a7c3790954a7953dfd /tests/util_test.py
parentReleasing debian version 2.20.0-2. (diff)
downloadpre-commit-2e8bfde15d76ad56da2d1bbd99294dafd4e4372f.tar.xz
pre-commit-2e8bfde15d76ad56da2d1bbd99294dafd4e4372f.zip
Merging upstream version 2.21.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/util_test.py')
-rw-r--r--tests/util_test.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/util_test.py b/tests/util_test.py
index 6b00f9f..b3f18b4 100644
--- a/tests/util_test.py
+++ b/tests/util_test.py
@@ -18,11 +18,10 @@ from pre_commit.util import tmpdir
def test_CalledProcessError_str():
- error = CalledProcessError(1, ('exe',), 0, b'output', b'errors')
+ error = CalledProcessError(1, ('exe',), b'output', b'errors')
assert str(error) == (
"command: ('exe',)\n"
'return code: 1\n'
- 'expected return code: 0\n'
'stdout:\n'
' output\n'
'stderr:\n'
@@ -31,11 +30,10 @@ def test_CalledProcessError_str():
def test_CalledProcessError_str_nooutput():
- error = CalledProcessError(1, ('exe',), 0, b'', b'')
+ error = CalledProcessError(1, ('exe',), b'', b'')
assert str(error) == (
"command: ('exe',)\n"
'return code: 1\n'
- 'expected return code: 0\n'
'stdout: (none)\n'
'stderr: (none)'
)
@@ -83,14 +81,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 +99,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')