From 1ec57a0c6886eab277da507afa8316d03bc051dd Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Tue, 24 Apr 2018 00:42:32 +0000 Subject: [PATCH] Add basic test for rehash wait --- test/rehash.bats | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/rehash.bats b/test/rehash.bats index c5694f4e..8afe87e6 100755 --- a/test/rehash.bats +++ b/test/rehash.bats @@ -32,6 +32,15 @@ create_executable() { assert_failure "pyenv: cannot rehash: ${PYENV_ROOT}/shims/.pyenv-shim exists" } +@test "wait until lock acquisition" { + export PYENV_REHASH_TIMEOUT=5 + mkdir -p "${PYENV_ROOT}/shims" + touch "${PYENV_ROOT}/shims/.pyenv-shim" + bash -c "sleep 1 && rm -f ${PYENV_ROOT}/shims/.pyenv-shim" & + run pyenv-rehash + assert_success +} + @test "creates shims" { create_executable "2.7" "python" create_executable "2.7" "fab"