Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

52 linhas
1.2 KiB

  1. #!/usr/bin/env bats
  2. load test_helper
  3. @test "no shell version" {
  4. mkdir -p "${PYENV_TEST_DIR}/myproject"
  5. cd "${PYENV_TEST_DIR}/myproject"
  6. echo "1.2.3" > .python-version
  7. PYENV_VERSION="" run pyenv-sh-shell
  8. assert_failure "pyenv: no shell-specific version configured"
  9. }
  10. @test "shell version" {
  11. PYENV_SHELL=bash PYENV_VERSION="1.2.3" run pyenv-sh-shell
  12. assert_success 'echo "$PYENV_VERSION"'
  13. }
  14. @test "shell version (fish)" {
  15. PYENV_SHELL=fish PYENV_VERSION="1.2.3" run pyenv-sh-shell
  16. assert_success 'echo "$PYENV_VERSION"'
  17. }
  18. @test "shell unset" {
  19. PYENV_SHELL=bash run pyenv-sh-shell --unset
  20. assert_success "unset PYENV_VERSION"
  21. }
  22. @test "shell unset (fish)" {
  23. PYENV_SHELL=fish run pyenv-sh-shell --unset
  24. assert_success "set -e PYENV_VERSION"
  25. }
  26. @test "shell change invalid version" {
  27. run pyenv-sh-shell 1.2.3
  28. assert_failure
  29. assert_output <<SH
  30. pyenv: version \`1.2.3' not installed
  31. false
  32. SH
  33. }
  34. @test "shell change version" {
  35. mkdir -p "${PYENV_ROOT}/versions/1.2.3"
  36. PYENV_SHELL=bash run pyenv-sh-shell 1.2.3
  37. assert_success 'export PYENV_VERSION="1.2.3"'
  38. }
  39. @test "shell change version (fish)" {
  40. mkdir -p "${PYENV_ROOT}/versions/1.2.3"
  41. PYENV_SHELL=fish run pyenv-sh-shell 1.2.3
  42. assert_success 'setenv PYENV_VERSION "1.2.3"'
  43. }