`test_run_with_check_raise` fails on OpenIndiana
mtelka opened this issue · 0 comments
mtelka commented
The test_run_with_check_raise
test fails on OpenIndiana with this error:
__________________________ test_run_with_check_raise ___________________________
def test_run_with_check_raise() -> None:
"""Asure compatibility with subprocess.run when using check (return 1)."""
with pytest.raises(subprocess.CalledProcessError) as ours:
run("false", check=True)
with pytest.raises(subprocess.CalledProcessError) as original:
subprocess.run("false", check=True, universal_newlines=True)
> assert ours.value.returncode == original.value.returncode
E AssertionError: assert 1 == 255
E + where 1 = CalledProcessError(1, 'false').returncode
E + where CalledProcessError(1, 'false') = <ExceptionInfo CalledProcessError(1, 'false') tblen=2>.value
E + and 255 = CalledProcessError(255, 'false').returncode
E + where CalledProcessError(255, 'false') = <ExceptionInfo CalledProcessError(255, 'false') tblen=2>.value
test/test_unit.py:114: AssertionError
On OpenIndiana there are two false
commands:
$ /usr/bin/false ; echo $?
255
$ /usr/gnu/bin/false ; echo $?
1
$
When the test is run the PATH
environment variable contains /usr/bin
before /usr/gnu/bin
, but the user's default is the opposite. This means that run()
(ours
) honors current PATH
, but subprocess.run()
(original
) does not.