diff --git a/test/exec.bats b/test/exec.bats index e603c3f8..209d9cf4 100644 --- a/test/exec.bats +++ b/test/exec.bats @@ -140,3 +140,21 @@ $envvarname=/unusual/shim/location:/another/shim/location _PYENV_SHIM_PATH= ! } + +@test "fails on non-Linux system" { + # Make sure to use the system version of Python + mkdir -p "$PYENV_TEST_DIR" + cd "$PYENV_TEST_DIR" + echo '' > .python-version + + run uname -s + if [ "$output" != Linux ]; then + run pyenv-exec -N env + assert_failure + assert_output 'Error: the --environment option is supported only on Linux' + else + run pyenv-exec -N env + echo "$status" + assert_success + fi +}