mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c85c1c9ed5 | ||
|
|
cd6a51ad68 | ||
|
|
85d8c5aabf | ||
|
|
fca12418ca | ||
|
|
13bc1877ef | ||
|
|
a724aaa149 | ||
|
|
f4162706d8 | ||
|
|
77a7644ff7 | ||
|
|
826f3fbe6f |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: ['https://www.bountysource.com/teams/pyenv-virtualenv/issues'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
|
||||
4
.github/ISSUE_TEMPLATE.md
vendored
4
.github/ISSUE_TEMPLATE.md
vendored
@@ -22,7 +22,11 @@ Make sure you have checked all steps below.
|
||||
* If the problem happens in a Pyenv invocation, you can turn on debug logging by setting `PYENV_DEBUG=1`, e.g. `env PYENV_DEBUG=1 pyenv install -v 3.6.4`
|
||||
* If the problem happens outside of a Pyenv invocation, get the debug log like this:
|
||||
```
|
||||
# for Bash
|
||||
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||
# for Zsh
|
||||
export PS4='+(%x:%I): %N(%i): '
|
||||
|
||||
set -x
|
||||
<reproduce the problem>
|
||||
set +x
|
||||
|
||||
@@ -34,6 +34,12 @@ From inside that directory you can:
|
||||
$ git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
|
||||
```
|
||||
|
||||
For the Fish shell:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/pyenv/pyenv-virtualenv.git (pyenv root)/plugins/pyenv-virtualenv
|
||||
```
|
||||
|
||||
2. (OPTIONAL) **Add `pyenv virtualenv-init` to your shell** to enable auto-activation of virtualenvs. This is entirely optional but pretty useful. See "Activate virtualenv" below.
|
||||
|
||||
```sh
|
||||
|
||||
@@ -25,6 +25,27 @@ resolve_link() {
|
||||
unset FORCE
|
||||
unset QUIET
|
||||
|
||||
# Define `before_activate` and `after_activate` functions that allow
|
||||
# plugin hooks to register a string of code for execution before or
|
||||
# after activating a virtualenv.
|
||||
declare -a before_hooks after_hooks
|
||||
|
||||
before_activate() {
|
||||
local hook="$1"
|
||||
before_hooks["${#before_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
after_activate() {
|
||||
local hook="$1"
|
||||
after_hooks["${#after_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
# Load plugin hooks.
|
||||
OLDIFS="$IFS"
|
||||
IFS=$'\n' scripts=(`pyenv-hooks activate`)
|
||||
IFS="$OLDIFS"
|
||||
for script in "${scripts[@]}"; do source "$script"; done
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"--complete" )
|
||||
@@ -137,6 +158,9 @@ fi
|
||||
|
||||
pyenv-sh-deactivate --force --quiet || true
|
||||
|
||||
# Execute `before_activate` hooks.
|
||||
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
|
||||
echo "pyenv-virtualenv: activate ${venv}" 1>&2
|
||||
fi
|
||||
@@ -225,9 +249,6 @@ if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
if [ -z "${QUIET}" ]; then
|
||||
echo "pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior." 1>&2
|
||||
fi
|
||||
cat <<EOS
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(${venv}) \${PS1:-}";
|
||||
@@ -261,3 +282,6 @@ if [ -d "${prefix}/conda-meta" ] ||
|
||||
esac
|
||||
shopt -u nullglob
|
||||
fi
|
||||
|
||||
# Execute `after_activate` hooks.
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
@@ -16,6 +16,27 @@ fi
|
||||
unset FORCE
|
||||
unset QUIET
|
||||
|
||||
# Define `before_deactivate` and `after_deactivate` functions that allow
|
||||
# plugin hooks to register a string of code for execution before or
|
||||
# after deactivating a virtualenv.
|
||||
declare -a before_hooks after_hooks
|
||||
|
||||
before_deactivate() {
|
||||
local hook="$1"
|
||||
before_hooks["${#before_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
after_deactivate() {
|
||||
local hook="$1"
|
||||
after_hooks["${#after_hooks[@]}"]="$hook"
|
||||
}
|
||||
|
||||
# Load plugin hooks.
|
||||
OLDIFS="$IFS"
|
||||
IFS=$'\n' scripts=(`pyenv-hooks deactivate`)
|
||||
IFS="$OLDIFS"
|
||||
for script in "${scripts[@]}"; do source "$script"; done
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"-f" | "--force" )
|
||||
@@ -54,6 +75,9 @@ else
|
||||
venv="${prefix##*/}"
|
||||
fi
|
||||
|
||||
# Execute `before_deactivate` hooks.
|
||||
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
|
||||
echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
|
||||
fi
|
||||
@@ -191,3 +215,6 @@ fi;
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
|
||||
# Execute `after_deactivate` hooks.
|
||||
for hook in "${after_hooks[@]}"; do eval "$hook"; done
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
# -u/--upgrade Imply --force
|
||||
#
|
||||
|
||||
PYENV_VIRTUALENV_VERSION="1.1.5"
|
||||
PYENV_VIRTUALENV_VERSION="1.2.1"
|
||||
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
@@ -336,10 +336,20 @@ fi
|
||||
# Set VERSION_NAME as default version in this script
|
||||
export PYENV_VERSION="${VERSION_NAME}"
|
||||
|
||||
not_installed_message() {
|
||||
local is_available=$(python-build --definitions | grep -F -x "$1")
|
||||
echo "pyenv-virtualenv: \`${1}' is not installed in pyenv." 1>&2
|
||||
if [[ $is_available ]]; then
|
||||
echo "Run \`pyenv install ${1}' to install it." 1>&2
|
||||
else
|
||||
echo "It does not look like a valid Python version. See \`pyenv install --list' for available versions." 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
# Source version must exist before creating virtualenv.
|
||||
PREFIX="$(pyenv-prefix 2>/dev/null || true)"
|
||||
if [ ! -d "${PREFIX}" ]; then
|
||||
echo "pyenv-virtualenv: \`${PYENV_VERSION}' is not installed in pyenv." 1>&2
|
||||
not_installed_message "${PYENV_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -441,7 +451,8 @@ else
|
||||
if [ -x "${python}" ]; then
|
||||
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--python=${python}"
|
||||
else
|
||||
echo "pyenv-virtualenv: \`${VIRTUALENV_PYTHON##*/}' is not installed in pyenv." 1>&2
|
||||
# echo "pyenv-virtualenv: \`${VIRTUALENV_PYTHON##*/}' is not installed in pyenv." 1>&2
|
||||
not_installed_message "${VIRTUALENV_PYTHON##*/}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -589,6 +600,15 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
(
|
||||
shopt -s nullglob
|
||||
for extra_binary in "$PREFIX"/bin/python*-config; do
|
||||
extra_binary_linkname="$VIRTUALENV_PATH/bin/$(basename $extra_binary)"
|
||||
[[ -e "$extra_binary_linkname" ]] || \
|
||||
ln -s "$extra_binary" "$extra_binary_linkname"
|
||||
done
|
||||
)
|
||||
|
||||
## Create symlink in the `versions` directory for backward compatibility
|
||||
if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
||||
|
||||
@@ -16,6 +16,7 @@ setup() {
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
stub pyenv-hooks "activate : echo"
|
||||
}
|
||||
|
||||
@test "activate virtualenv from current version" {
|
||||
@@ -33,7 +34,6 @@ setup() {
|
||||
deactivated
|
||||
export PYENV_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.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
@@ -86,7 +86,6 @@ deactivated
|
||||
pyenv-virtualenv: activate venv
|
||||
export PYENV_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.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
@@ -114,7 +113,6 @@ export PYENV_VERSION="venv";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_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.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
EOS
|
||||
@@ -191,7 +189,6 @@ export PYENV_VERSION="venv27";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv27) \${PS1:-}";
|
||||
EOS
|
||||
@@ -217,7 +214,6 @@ export PYENV_VERSION="venv27";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv27) \${PS1:-}";
|
||||
EOS
|
||||
@@ -390,7 +386,6 @@ export PYENV_VERSION="venv27:2.7.10";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv27) \${PS1:-}";
|
||||
EOS
|
||||
|
||||
@@ -17,6 +17,11 @@ setup() {
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
stub pyenv-hooks "activate : echo"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
unstub pyenv-hooks
|
||||
}
|
||||
|
||||
@test "activate conda root from current version" {
|
||||
@@ -36,7 +41,6 @@ deactivated
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/anaconda-2.3.0";
|
||||
export CONDA_DEFAULT_ENV="root";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(anaconda-2.3.0) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
@@ -95,7 +99,6 @@ export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
|
||||
export CONDA_DEFAULT_ENV="root";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(miniconda-3.9.1) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1";
|
||||
@@ -125,7 +128,6 @@ deactivated
|
||||
export PYENV_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";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(anaconda-2.3.0/envs/foo) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/anaconda-2.3.0/envs/foo";
|
||||
@@ -158,7 +160,6 @@ export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
|
||||
export CONDA_DEFAULT_ENV="bar";
|
||||
pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(miniconda-3.9.1/envs/bar) \${PS1:-}";
|
||||
export CONDA_PREFIX="${TMP}/pyenv/versions/miniconda-3.9.1/envs/bar";
|
||||
|
||||
@@ -16,6 +16,11 @@ setup() {
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
stub pyenv-hooks "deactivate : echo"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
unstub pyenv-hooks
|
||||
}
|
||||
|
||||
@test "deactivate conda root" {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bats
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@@ -16,6 +16,7 @@ setup() {
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
stub pyenv-hooks "deactivate : echo"
|
||||
}
|
||||
|
||||
@test "deactivate virtualenv" {
|
||||
|
||||
@@ -40,3 +40,74 @@ OUT
|
||||
unstub pyenv-rehash
|
||||
teardown_version "3.5.1"
|
||||
}
|
||||
|
||||
@test "pyenv-sh-activate hooks" {
|
||||
cat > "${HOOK_PATH}/activate.bash" <<OUT
|
||||
before_activate 'echo "before"'
|
||||
after_activate 'echo "after"'
|
||||
OUT
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
|
||||
stub pyenv-version-name "echo venv"
|
||||
stub pyenv-virtualenv-prefix ""
|
||||
stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||
stub pyenv-hooks "activate : echo '$HOOK_PATH'/activate.bash"
|
||||
stub pyenv-sh-deactivate ""
|
||||
|
||||
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
before
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1:-}";
|
||||
export PS1="(venv) \${PS1:-}";
|
||||
after
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-prefix
|
||||
unstub pyenv-hooks
|
||||
unstub pyenv-sh-deactivate
|
||||
}
|
||||
|
||||
@test "deactivate virtualenv" {
|
||||
cat > "${HOOK_PATH}/deactivate.bash" <<OUT
|
||||
before_deactivate 'echo "before"'
|
||||
after_deactivate 'echo "after"'
|
||||
OUT
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export PYENV_ACTIVATE_SHELL=
|
||||
stub pyenv-hooks "deactivate : echo '$HOOK_PATH'/deactivate.bash"
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
before
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH:-}" ]; then
|
||||
export PATH="\${_OLD_VIRTUAL_PATH}";
|
||||
unset _OLD_VIRTUAL_PATH;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PYTHONHOME:-}" ]; then
|
||||
export PYTHONHOME="\${_OLD_VIRTUAL_PYTHONHOME}";
|
||||
unset _OLD_VIRTUAL_PYTHONHOME;
|
||||
fi;
|
||||
if [ -n "\${_OLD_VIRTUAL_PS1:-}" ]; then
|
||||
export PS1="\${_OLD_VIRTUAL_PS1}";
|
||||
unset _OLD_VIRTUAL_PS1;
|
||||
fi;
|
||||
if declare -f deactivate 1>/dev/null 2>&1; then
|
||||
unset -f deactivate;
|
||||
fi;
|
||||
after
|
||||
EOS
|
||||
|
||||
unstub pyenv-hooks
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ setup() {
|
||||
stub pyenv-rehash " : true"
|
||||
stub pyenv-version-name "echo \${PYENV_VERSION}"
|
||||
stub curl true
|
||||
stub python-build "echo python2.7"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
@@ -22,6 +23,7 @@ teardown() {
|
||||
unstub pyenv-prefix
|
||||
unstub pyenv-hooks
|
||||
unstub pyenv-rehash
|
||||
unstub python-build
|
||||
teardown_version "2.7.8"
|
||||
rm -fr "$TMP"/*
|
||||
}
|
||||
@@ -96,6 +98,7 @@ OUT
|
||||
|
||||
assert_output <<OUT
|
||||
pyenv-virtualenv: \`python2.7' is not installed in pyenv.
|
||||
Run \`pyenv install python2.7' to install it.
|
||||
OUT
|
||||
assert_failure
|
||||
|
||||
@@ -106,3 +109,13 @@ OUT
|
||||
remove_executable "2.7.8" "python2.7"
|
||||
remove_executable "2.7.9" "python2.7"
|
||||
}
|
||||
|
||||
@test "invalid python name" {
|
||||
run pyenv-virtualenv --verbose --python=99.99.99 venv
|
||||
|
||||
assert_output <<OUT
|
||||
pyenv-virtualenv: \`99.99.99' is not installed in pyenv.
|
||||
It does not look like a valid Python version. See \`pyenv install --list' for available versions.
|
||||
OUT
|
||||
assert_failure
|
||||
}
|
||||
@@ -29,10 +29,13 @@ unstub_pyenv() {
|
||||
stub pyenv-exec "python2.7 -m venv --help : false"
|
||||
stub pyenv-exec "python2 -m venv --help : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\"; mkdir -p \"\$2/bin\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
stub curl true
|
||||
create_executable "${PYENV_VERSION}" "python-config"
|
||||
create_executable "${PYENV_VERSION}" "python2-config"
|
||||
create_executable "${PYENV_VERSION}" "python2.7-config"
|
||||
|
||||
run pyenv-virtualenv "2.7.11" "venv"
|
||||
|
||||
@@ -41,8 +44,10 @@ PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||
assert_success
|
||||
for x in pydoc python-config python2-config python2.7-config; do
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/$x" ]
|
||||
done
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-virtualenv-prefix
|
||||
|
||||
Reference in New Issue
Block a user