1 Commits

Author SHA1 Message Date
k
abaeb2af6c Merge 5d7894d189 into 28cd9be54e 2024-09-18 12:11:58 -07:00
6 changed files with 15 additions and 36 deletions

View File

@@ -22,8 +22,10 @@ fi
{ printf "\x1B[31;1m"
echo
echo "\`pyenv activate' requires Pyenv and Pyenv-Virtualenv to be loaded into your shell."
echo "Check your shell configuration and Pyenv and Pyenv-Virtualenv installation instructions."
echo "Failed to activate virtualenv."
echo
echo "Perhaps pyenv-virtualenv has not been loaded into your shell properly."
echo "Please restart current shell and try again."
echo
printf "\x1B[0m"
} 1>&2

View File

@@ -11,8 +11,10 @@ set -e
{ printf "\x1B[31;1m"
echo
echo "\`pyenv deactivate' requires Pyenv and Pyenv-Virtualenv to be loaded into your shell."
echo "Check your shell configuration and Pyenv and Pyenv-Virtualenv installation instructions."
echo "Failed to deactivate virtualenv."
echo
echo "Perhaps pyenv-virtualenv has not been loaded into your shell properly."
echo "Please restart current shell and try again."
echo
printf "\x1B[0m"
} 1>&2

View File

@@ -605,13 +605,7 @@ STATUS=0
mkdir -p "${PYENV_VIRTUALENV_CACHE_PATH}"
cd "${PYENV_VIRTUALENV_CACHE_PATH}"
if [ -n "${USE_CONDA}" ]; then
if [ -z "$VIRTUALENV_PYTHON" ]; then
#process substitution doesn't seem to work unless it's directly inserted to the command line
#if we add it to VIRTUALENV_OPTIONS instead, "broken pipe" happens
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" --file <(pyenv-exec conda list python --full-name --export) || STATUS="$?"
else
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" || STATUS="$?"
fi
pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?"
else
if [ -n "${USE_M_VENV}" ]; then
pyenv-exec "${M_VENV_PYTHON_BIN:-python}" -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"
@@ -631,8 +625,7 @@ fi
## Create symlink in the `versions` directory for backward compatibility
if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
# Overwrite an existing link, can happen if running with -f
ln -fsn "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
fi
if [ ! -e "${VIRTUALENV_PATH}/bin/pydoc" ]; then

View File

@@ -32,8 +32,8 @@ unstub_pyenv() {
run pyenv-virtualenv venv
assert_success
assert_output_wildcards <<OUT
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes --file /dev/fd/*
assert_output <<OUT
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python
rehashed
OUT
@@ -56,7 +56,7 @@ OUT
assert_success
assert_output <<OUT
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5 python
rehashed
OUT
@@ -79,7 +79,7 @@ OUT
assert_success
assert_output <<OUT
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5
PYENV_VERSION=miniconda3-3.16.0 conda create --name venv --yes python=3.5 python
rehashed
OUT

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bats
#!/usr/bin/env bats
load test_helper

View File

@@ -83,16 +83,6 @@ assert_equal() {
fi
}
assert_equal_wildcards() {
if [[ $1 != $2 ]]; then
{ echo "expected:"
echo "$2"
echo "actual:"
echo "$1"
} | flunk
fi
}
assert_output() {
local expected
if [ $# -eq 0 ]; then expected="$(cat -)"
@@ -101,14 +91,6 @@ assert_output() {
assert_equal "$expected" "$output"
}
assert_output_wildcards() {
local expected
if [ $# -eq 0 ]; then expected="$(cat -)"
else expected="$1"
fi
assert_equal_wildcards "$output" "$expected"
}
assert_output_contains() {
local expected="$1"
echo "$output" | grep -F "$expected" >/dev/null || {