Deactivation before activation should not return as non-zero (fixes #116)

This commit is contained in:
Yamashita, Yuu
2015-11-26 09:15:02 +00:00
parent aea9eda680
commit aae07d1318
3 changed files with 65 additions and 39 deletions

View File

@@ -128,7 +128,7 @@ if [ -z "$PYENV_VIRTUALENV_INIT" ]; then
fi fi
fi fi
pyenv-sh-deactivate --quiet ${VERBOSE+--verbose} || true pyenv-sh-deactivate --force --quiet ${VERBOSE+--verbose} || true
echo "pyenv-virtualenv: activate ${venv}" 1>&2 echo "pyenv-virtualenv: activate ${venv}" 1>&2

View File

@@ -23,16 +23,18 @@ setup() {
stub pyenv-version-name "echo venv" stub pyenv-version-name "echo venv"
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
stub pyenv-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 PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate
unstub pyenv-version-name unstub pyenv-version-name
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
stub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate venv pyenv-virtualenv: activate venv
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"; export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior. pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
@@ -47,16 +49,18 @@ EOS
stub pyenv-version-name "echo venv" stub pyenv-version-name "echo venv"
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
stub pyenv-sh-deactivate "--force --quiet --verbose : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate --verbose PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate --verbose
unstub pyenv-version-name unstub pyenv-version-name
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate venv pyenv-virtualenv: activate venv
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"; export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior. pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
@@ -71,12 +75,14 @@ EOS
stub pyenv-version-name "echo venv" stub pyenv-version-name "echo venv"
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
stub pyenv-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 PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate
unstub pyenv-version-name unstub pyenv-version-name
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
@@ -85,7 +91,7 @@ EOS
eval "\$(pyenv virtualenv-init -)" eval "\$(pyenv virtualenv-init -)"
false deactivated
pyenv-virtualenv: activate venv pyenv-virtualenv: activate venv
export PYENV_VERSION="venv"; export PYENV_VERSION="venv";
export PYENV_ACTIVATE_SHELL=1; export PYENV_ACTIVATE_SHELL=1;
@@ -102,16 +108,18 @@ EOS
stub pyenv-version-name "echo venv" stub pyenv-version-name "echo venv"
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
stub pyenv-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="fish" PYENV_VERSION="venv" run pyenv-sh-activate PYENV_SHELL="fish" PYENV_VERSION="venv" run pyenv-sh-activate
unstub pyenv-version-name unstub pyenv-version-name
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate venv pyenv-virtualenv: activate venv
setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv"; setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
pyenv-virtualenv: prompt changing not work for fish. pyenv-virtualenv: prompt changing not work for fish.
@@ -124,12 +132,14 @@ EOS
stub pyenv-version-name "echo venv" stub pyenv-version-name "echo venv"
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\"" stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
stub pyenv-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="fish" PYENV_VERSION="venv" run pyenv-sh-activate PYENV_SHELL="fish" PYENV_VERSION="venv" run pyenv-sh-activate
unstub pyenv-version-name unstub pyenv-version-name
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
@@ -138,7 +148,7 @@ EOS
status --is-interactive; and . (pyenv virtualenv-init -|psub) status --is-interactive; and . (pyenv virtualenv-init -|psub)
false deactivated
pyenv-virtualenv: activate venv pyenv-virtualenv: activate venv
setenv PYENV_VERSION "venv"; setenv PYENV_VERSION "venv";
setenv PYENV_ACTIVATE_SHELL 1; setenv PYENV_ACTIVATE_SHELL 1;
@@ -152,15 +162,17 @@ EOS
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate "venv27" PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate "venv27"
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate venv27 pyenv-virtualenv: activate venv27
export PYENV_VERSION="venv27"; export PYENV_VERSION="venv27";
export PYENV_ACTIVATE_SHELL=1; export PYENV_ACTIVATE_SHELL=1;
@@ -176,11 +188,13 @@ EOS
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate "venv27" PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate "venv27"
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
@@ -189,7 +203,7 @@ EOS
eval "\$(pyenv virtualenv-init -)" eval "\$(pyenv virtualenv-init -)"
false deactivated
pyenv-virtualenv: activate venv27 pyenv-virtualenv: activate venv27
export PYENV_VERSION="venv27"; export PYENV_VERSION="venv27";
export PYENV_ACTIVATE_SHELL=1; export PYENV_ACTIVATE_SHELL=1;
@@ -205,15 +219,17 @@ EOS
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="fish" PYENV_VERSION="venv" run pyenv-sh-activate "venv27" PYENV_SHELL="fish" PYENV_VERSION="venv" run pyenv-sh-activate "venv27"
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate venv27 pyenv-virtualenv: activate venv27
setenv PYENV_VERSION "venv27"; setenv PYENV_VERSION "venv27";
setenv PYENV_ACTIVATE_SHELL 1; setenv PYENV_ACTIVATE_SHELL 1;
@@ -227,11 +243,13 @@ EOS
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="fish" PYENV_VERSION="venv" run pyenv-sh-activate "venv27" PYENV_SHELL="fish" PYENV_VERSION="venv" run pyenv-sh-activate "venv27"
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
unstub pyenv-sh-deactivate
assert_success assert_success
assert_output <<EOS assert_output <<EOS
@@ -240,7 +258,7 @@ EOS
status --is-interactive; and . (pyenv virtualenv-init -|psub) status --is-interactive; and . (pyenv virtualenv-init -|psub)
false deactivated
pyenv-virtualenv: activate venv27 pyenv-virtualenv: activate venv27
setenv PYENV_VERSION "venv27"; setenv PYENV_VERSION "venv27";
setenv PYENV_ACTIVATE_SHELL 1; setenv PYENV_ACTIVATE_SHELL 1;
@@ -253,7 +271,7 @@ EOS
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv" export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
export PYENV_ACTIVATE_SHELL= export PYENV_ACTIVATE_SHELL=
stub pyenv-sh-deactivate "echo deactivated" stub pyenv-sh-deactivate " : echo deactivated"
run pyenv-sh-activate --unset run pyenv-sh-activate --unset
@@ -270,8 +288,6 @@ EOS
run pyenv-sh-activate "3.3.3" run pyenv-sh-activate "3.3.3"
unstub pyenv-virtualenv-prefix
assert_failure assert_failure
assert_output <<EOS assert_output <<EOS
pyenv-virtualenv: version \`3.3.3' is not a virtualenv pyenv-virtualenv: version \`3.3.3' is not a virtualenv
@@ -328,8 +344,6 @@ EOS
run pyenv-sh-activate "2.7.10" "venv27" run pyenv-sh-activate "2.7.10" "venv27"
unstub pyenv-virtualenv-prefix
assert_failure assert_failure
assert_output <<EOS assert_output <<EOS
pyenv-virtualenv: version \`2.7.10' is not a virtualenv pyenv-virtualenv: version \`2.7.10' is not a virtualenv
@@ -340,18 +354,20 @@ EOS
@test "activate if the first virtualenv is a virtualenv" { @test "activate if the first virtualenv is a virtualenv" {
export PYENV_VIRTUALENV_INIT=1 export PYENV_VIRTUALENV_INIT=1
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
stub pyenv-virtualenv-prefix "2.7.10 : false" stub pyenv-virtualenv-prefix "2.7.10 : false"
stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\"" stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
run pyenv-sh-activate "venv27" "2.7.10" run pyenv-sh-activate "venv27" "2.7.10"
unstub pyenv-sh-deactivate
unstub pyenv-virtualenv-prefix unstub pyenv-virtualenv-prefix
unstub pyenv-prefix unstub pyenv-prefix
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate venv27 pyenv-virtualenv: activate venv27
export PYENV_VERSION="venv27:2.7.10"; export PYENV_VERSION="venv27:2.7.10";
export PYENV_ACTIVATE_SHELL=1; export PYENV_ACTIVATE_SHELL=1;

View File

@@ -24,16 +24,13 @@ setup() {
stub pyenv-version-name "echo anaconda-2.3.0" stub pyenv-version-name "echo anaconda-2.3.0"
stub pyenv-virtualenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\"" stub pyenv-virtualenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\""
stub pyenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\"" stub pyenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0" run pyenv-sh-activate PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0" run pyenv-sh-activate
unstub pyenv-version-name
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate anaconda-2.3.0 pyenv-virtualenv: activate anaconda-2.3.0
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0"; export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
export CONDA_DEFAULT_ENV="root"; export CONDA_DEFAULT_ENV="root";
@@ -41,6 +38,11 @@ pyenv-virtualenv: prompt changing will be removed from future release. configure
export _OLD_VIRTUAL_PS1="\${PS1}"; export _OLD_VIRTUAL_PS1="\${PS1}";
export PS1="(anaconda-2.3.0) \${PS1}"; export PS1="(anaconda-2.3.0) \${PS1}";
EOS EOS
unstub pyenv-version-name
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
unstub pyenv-sh-deactivate
} }
@test "activate conda root from current version (fish)" { @test "activate conda root from current version (fish)" {
@@ -50,21 +52,23 @@ EOS
stub pyenv-version-name "echo anaconda-2.3.0" stub pyenv-version-name "echo anaconda-2.3.0"
stub pyenv-virtualenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\"" stub pyenv-virtualenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\""
stub pyenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\"" stub pyenv-prefix "anaconda-2.3.0 : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="fish" PYENV_VERSION="anaconda-2.3.0" run pyenv-sh-activate PYENV_SHELL="fish" PYENV_VERSION="anaconda-2.3.0" run pyenv-sh-activate
unstub pyenv-version-name
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate anaconda-2.3.0 pyenv-virtualenv: activate anaconda-2.3.0
setenv VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0"; setenv VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
setenv CONDA_DEFAULT_ENV "root"; setenv CONDA_DEFAULT_ENV "root";
pyenv-virtualenv: prompt changing not work for fish. pyenv-virtualenv: prompt changing not work for fish.
EOS EOS
unstub pyenv-version-name
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
unstub pyenv-sh-deactivate
} }
@test "activate conda root from command-line argument" { @test "activate conda root from command-line argument" {
@@ -74,15 +78,13 @@ EOS
create_conda "miniconda-3.9.1" create_conda "miniconda-3.9.1"
stub pyenv-virtualenv-prefix "miniconda-3.9.1 : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1\"" stub pyenv-virtualenv-prefix "miniconda-3.9.1 : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1\""
stub pyenv-prefix "miniconda-3.9.1 : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1\"" stub pyenv-prefix "miniconda-3.9.1 : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0" run pyenv-sh-activate "miniconda-3.9.1" PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0" run pyenv-sh-activate "miniconda-3.9.1"
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate miniconda-3.9.1 pyenv-virtualenv: activate miniconda-3.9.1
export PYENV_VERSION="miniconda-3.9.1"; export PYENV_VERSION="miniconda-3.9.1";
export PYENV_ACTIVATE_SHELL=1; export PYENV_ACTIVATE_SHELL=1;
@@ -92,6 +94,10 @@ pyenv-virtualenv: prompt changing will be removed from future release. configure
export _OLD_VIRTUAL_PS1="\${PS1}"; export _OLD_VIRTUAL_PS1="\${PS1}";
export PS1="(miniconda-3.9.1) \${PS1}"; export PS1="(miniconda-3.9.1) \${PS1}";
EOS EOS
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
unstub pyenv-sh-deactivate
} }
@test "activate conda env from current version" { @test "activate conda env from current version" {
@@ -101,16 +107,13 @@ EOS
stub pyenv-version-name "echo anaconda-2.3.0/envs/foo" stub pyenv-version-name "echo anaconda-2.3.0/envs/foo"
stub pyenv-virtualenv-prefix "anaconda-2.3.0/envs/foo : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\"" stub pyenv-virtualenv-prefix "anaconda-2.3.0/envs/foo : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\""
stub pyenv-prefix "anaconda-2.3.0/envs/foo : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\"" stub pyenv-prefix "anaconda-2.3.0/envs/foo : echo \"${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0/envs/foo" run pyenv-sh-activate PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0/envs/foo" run pyenv-sh-activate
unstub pyenv-version-name
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate anaconda-2.3.0/envs/foo pyenv-virtualenv: activate anaconda-2.3.0/envs/foo
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo"; export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo";
export CONDA_DEFAULT_ENV="foo"; export CONDA_DEFAULT_ENV="foo";
@@ -118,6 +121,11 @@ pyenv-virtualenv: prompt changing will be removed from future release. configure
export _OLD_VIRTUAL_PS1="\${PS1}"; export _OLD_VIRTUAL_PS1="\${PS1}";
export PS1="(anaconda-2.3.0/envs/foo) \${PS1}"; export PS1="(anaconda-2.3.0/envs/foo) \${PS1}";
EOS EOS
unstub pyenv-version-name
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
unstub pyenv-sh-deactivate
} }
@test "activate conda env from command-line argument" { @test "activate conda env from command-line argument" {
@@ -127,15 +135,13 @@ EOS
create_conda "miniconda-3.9.1" "bar" create_conda "miniconda-3.9.1" "bar"
stub pyenv-virtualenv-prefix "miniconda-3.9.1/envs/bar : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1\"" stub pyenv-virtualenv-prefix "miniconda-3.9.1/envs/bar : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1\""
stub pyenv-prefix "miniconda-3.9.1/envs/bar : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar\"" stub pyenv-prefix "miniconda-3.9.1/envs/bar : echo \"${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar\""
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0/envs/foo" run pyenv-sh-activate "miniconda-3.9.1/envs/bar" PYENV_SHELL="bash" PYENV_VERSION="anaconda-2.3.0/envs/foo" run pyenv-sh-activate "miniconda-3.9.1/envs/bar"
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
assert_success assert_success
assert_output <<EOS assert_output <<EOS
false deactivated
pyenv-virtualenv: activate miniconda-3.9.1/envs/bar pyenv-virtualenv: activate miniconda-3.9.1/envs/bar
export PYENV_VERSION="miniconda-3.9.1/envs/bar"; export PYENV_VERSION="miniconda-3.9.1/envs/bar";
export PYENV_ACTIVATE_SHELL=1; export PYENV_ACTIVATE_SHELL=1;
@@ -145,4 +151,8 @@ pyenv-virtualenv: prompt changing will be removed from future release. configure
export _OLD_VIRTUAL_PS1="\${PS1}"; export _OLD_VIRTUAL_PS1="\${PS1}";
export PS1="(miniconda-3.9.1/envs/bar) \${PS1}"; export PS1="(miniconda-3.9.1/envs/bar) \${PS1}";
EOS EOS
unstub pyenv-virtualenv-prefix
unstub pyenv-prefix
unstub pyenv-sh-deactivate
} }