Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_run_with_check_raise fails on OpenIndiana #128

Open
mtelka opened this issue Jun 21, 2024 · 0 comments
Open

test_run_with_check_raise fails on OpenIndiana #128

mtelka opened this issue Jun 21, 2024 · 0 comments

Comments

@mtelka
Copy link

mtelka commented Jun 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant