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
1.1 KiB

10 years ago
  1. #!/usr/bin/env bats
  2. load test_helper
  3. @test "prefixes" {
  4. mkdir -p "${PYENV_TEST_DIR}/bin"
  5. touch "${PYENV_TEST_DIR}/bin/python"
  6. chmod +x "${PYENV_TEST_DIR}/bin/python"
  7. mkdir -p "${PYENV_ROOT}/versions/2.7.10"
  8. PYENV_VERSION="system:2.7.10" run pyenv-prefix
  9. assert_success "${PYENV_TEST_DIR}:${PYENV_ROOT}/versions/2.7.10"
  10. PYENV_VERSION="2.7.10:system" run pyenv-prefix
  11. assert_success "${PYENV_ROOT}/versions/2.7.10:${PYENV_TEST_DIR}"
  12. }
  13. @test "should use dirname of file argument as PYENV_DIR" {
  14. mkdir -p "${PYENV_TEST_DIR}/dir1"
  15. touch "${PYENV_TEST_DIR}/dir1/file.py"
  16. PYENV_FILE_ARG="${PYENV_TEST_DIR}/dir1/file.py" run pyenv echo PYENV_DIR
  17. assert_output "${PYENV_TEST_DIR}/dir1"
  18. }
  19. @test "should follow symlink of file argument (#379, #404)" {
  20. mkdir -p "${PYENV_TEST_DIR}/dir1"
  21. mkdir -p "${PYENV_TEST_DIR}/dir2"
  22. touch "${PYENV_TEST_DIR}/dir1/file.py"
  23. ln -s "${PYENV_TEST_DIR}/dir1/file.py" "${PYENV_TEST_DIR}/dir2/symlink.py"
  24. PYENV_FILE_ARG="${PYENV_TEST_DIR}/dir2/symlink.py" run pyenv echo PYENV_DIR
  25. assert_output "${PYENV_TEST_DIR}/dir1"
  26. }