From aae07d13184b1648a898dfba43b84aae43e70030 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Thu, 26 Nov 2015 09:15:02 +0000 Subject: [PATCH] Deactivation before activation should not return as non-zero (fixes #116) --- bin/pyenv-sh-activate | 2 +- test/activate.bats | 46 ++++++++++++++++++++++----------- test/conda-activate.bats | 56 +++++++++++++++++++++++----------------- 3 files changed, 65 insertions(+), 39 deletions(-) diff --git a/bin/pyenv-sh-activate b/bin/pyenv-sh-activate index 87d0e41..be7e453 100755 --- a/bin/pyenv-sh-activate +++ b/bin/pyenv-sh-activate @@ -128,7 +128,7 @@ if [ -z "$PYENV_VIRTUALENV_INIT" ]; then fi fi -pyenv-sh-deactivate --quiet ${VERBOSE+--verbose} || true +pyenv-sh-deactivate --force --quiet ${VERBOSE+--verbose} || true echo "pyenv-virtualenv: activate ${venv}" 1>&2 diff --git a/test/activate.bats b/test/activate.bats index 54069cb..4b48130 100644 --- a/test/activate.bats +++ b/test/activate.bats @@ -23,16 +23,18 @@ setup() { stub pyenv-version-name "echo venv" stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" + stub pyenv-sh-deactivate "--force --quiet : echo deactivated" PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate unstub pyenv-version-name unstub pyenv-virtualenv-prefix unstub pyenv-prefix + stub pyenv-sh-deactivate assert_success assert_output <