You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
792 B

пре 10 година
  1. #!/usr/bin/env bats
  2. load test_helper
  3. @test "prefix" {
  4. mkdir -p "${PYENV_TEST_DIR}/myproject"
  5. cd "${PYENV_TEST_DIR}/myproject"
  6. echo "1.2.3" > .python-version
  7. mkdir -p "${PYENV_ROOT}/versions/1.2.3"
  8. run pyenv-prefix
  9. assert_success "${PYENV_ROOT}/versions/1.2.3"
  10. }
  11. @test "prefix for invalid version" {
  12. PYENV_VERSION="1.2.3" run pyenv-prefix
  13. assert_failure "pyenv: version \`1.2.3' not installed"
  14. }
  15. @test "prefix for system" {
  16. mkdir -p "${PYENV_TEST_DIR}/bin"
  17. touch "${PYENV_TEST_DIR}/bin/python"
  18. chmod +x "${PYENV_TEST_DIR}/bin/python"
  19. PYENV_VERSION="system" run pyenv-prefix
  20. assert_success "$PYENV_TEST_DIR"
  21. }
  22. @test "prefix for invalid system" {
  23. PATH="$(path_without python)" run pyenv-prefix system
  24. assert_failure "pyenv: system version not found in PATH"
  25. }