From 24b494a858fd1aa0c7b8526fc3b35fcebffcec32 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sat, 16 Jul 2016 05:46:43 +0000 Subject: [PATCH 1/5] Use `-m venv` instead of `pyvenv` executable (fixes #184) --- bin/pyenv-virtualenv | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index f4d3686..3b2e34f 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -108,10 +108,7 @@ version() { echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (conda ${version:-unknown})" else if [ -n "$USE_PYVENV" ]; then - version="$(pyenv-which pyvenv 2>/dev/null || true)" - version="${version#${PYENV_ROOT}/versions/}" - version="${version%/bin/pyvenv}" - echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (pyvenv ${version:-unknown})" + echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (python -m venv)" else version="$(pyenv-exec virtualenv --version 2>/dev/null || true)" echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (virtualenv ${version:-unknown})" @@ -126,7 +123,7 @@ usage() { pyenv-exec conda create --help 2>/dev/null || true else if [ -n "${USE_PYVENV}" ]; then - pyenv-exec pyvenv --help 2>/dev/null || true + pyenv-exec python -m venv --help 2>/dev/null || true else pyenv-exec virtualenv --help 2>/dev/null || true fi @@ -144,11 +141,11 @@ detect_venv() { if [ -x "${prefix}/bin/virtualenv" ]; then HAS_VIRTUALENV=1 fi - if [ -x "${prefix}/bin/pyvenv" ]; then + if "${prefix}/bin/python" -m venv --help 1>/dev/null 2>&1; then HAS_PYVENV=1 fi fi - # Use pyvenv only if there is pyvenv, virtualenv is not installed, and `-p` not given + # Use `python -m venv` only if there is venv available, virtualenv is not installed, and `-p` not given if [ -n "${HAS_CONDA}" ]; then USE_CONDA=1 else @@ -371,7 +368,7 @@ REQUIREMENTS="${TMP}/requirements.${SEED}.txt" # Upgrade existing virtualenv if [ -n "$UPGRADE" ]; then FORCE=1 - # pyvenv has `--upgrade` by default + # `python -m venv` has `--upgrade` by default if [ -n "${USE_PYVENV}" ]; then unset UPGRADE VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--upgrade" @@ -406,11 +403,11 @@ if [ -n "${USE_CONDA}" ]; then fi else if [ -n "${USE_PYVENV}" ]; then - # Unset some arguments not supported by pyvenv + # Unset some arguments not supported by `python -m venv` unset QUIET unset VERBOSE if [ -n "${VIRTUALENV_PYTHON}" ]; then - echo "pyenv-virtualenv: \`--python=${VIRTUALENV_PYTHON}' is not supported by pyvenv." 1>&2 + echo "pyenv-virtualenv: \`--python=${VIRTUALENV_PYTHON}' is not supported by \`python -m venv'." 1>&2 exit 1 fi else @@ -525,7 +522,7 @@ if [ -n "${USE_CONDA}" ]; then pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?" else if [ -n "${USE_PYVENV}" ]; then - pyenv-exec pyvenv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" + pyenv-exec python -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" else pyenv-exec virtualenv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" fi From 7dc9f785891a3fca53c342c14ececb7959fa4024 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sat, 16 Jul 2016 05:49:41 +0000 Subject: [PATCH 2/5] sed -e `s/pyvenv/venv/g` README.md [ci skip] --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index eefc7a1..02b4b74 100644 --- a/README.md +++ b/README.md @@ -148,14 +148,14 @@ pyenv uninstall my-virtual-env ``` -### virtualenv and pyvenv +### virtualenv and venv There is a [venv](http://docs.python.org/3/library/venv.html) module available for CPython 3.3 and newer. -It provides a command-line tool `pyvenv` which is the successor of `virtualenv` +It provides an executable module `venv` which is the successor of `virtualenv` and distributed by default. -`pyenv-virtualenv` uses `pyvenv` if it is available and the `virtualenv` +`pyenv-virtualenv` uses `python -m venv` if it is available and the `virtualenv` command is not available. @@ -215,11 +215,11 @@ You can set certain environment variables to control pyenv-virtualenv. * `VIRTUALENV_VERSION`, if set, forces pyenv-virtualenv to install the desired version of virtualenv. If `virtualenv` has not been installed, pyenv-virtualenv will try to install the given version of virtualenv. -* `GET_PIP`, if set and `pyvenv` is preferred over `virtualenv`, +* `GET_PIP`, if set and `venv` is preferred over `virtualenv`, use `get_pip.py` from the specified location. -* `GET_PIP_URL`, if set and `pyvenv` is preferred over +* `GET_PIP_URL`, if set and `venv` is preferred over `virtualenv`, download `get_pip.py` from the specified URL. -* `PIP_VERSION`, if set and `pyvenv` is preferred +* `PIP_VERSION`, if set and `venv` is preferred over `virtualenv`, install the specified version of pip. From 187156d600d32084e1204b82053228db93529431 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sat, 16 Jul 2016 06:31:30 +0000 Subject: [PATCH 3/5] Use `python -m venv` instead on `pyvenv` in tests --- bin/pyenv-virtualenv | 2 +- test/envs.bats | 5 +++-- test/pip.bats | 10 ++++++---- test/pyvenv.bats | 10 ++++++++-- test/test_helper.bash | 5 ----- test/version.bats | 4 +++- test/virtualenv.bats | 5 +++++ 7 files changed, 26 insertions(+), 15 deletions(-) diff --git a/bin/pyenv-virtualenv b/bin/pyenv-virtualenv index 3b2e34f..d0286b2 100755 --- a/bin/pyenv-virtualenv +++ b/bin/pyenv-virtualenv @@ -141,7 +141,7 @@ detect_venv() { if [ -x "${prefix}/bin/virtualenv" ]; then HAS_VIRTUALENV=1 fi - if "${prefix}/bin/python" -m venv --help 1>/dev/null 2>&1; then + if pyenv-exec python -m venv --help 1>/dev/null 2>&1; then HAS_PYVENV=1 fi fi diff --git a/test/envs.bats b/test/envs.bats index 57b6d94..3dcc703 100644 --- a/test/envs.bats +++ b/test/envs.bats @@ -25,14 +25,15 @@ unstub_pyenv() { stub pyenv-version-name "echo '${PYENV_VERSION}'" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-virtualenv-prefix " : false" - stub pyenv-exec "pyvenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/3.5.1/envs/venv/bin" + stub pyenv-exec "python -m venv --help : true" + stub pyenv-exec "python -m venv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/3.5.1/envs/venv/bin" stub pyenv-exec "python -s -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip" run pyenv-virtualenv venv assert_success assert_output < Date: Sat, 16 Jul 2016 06:43:47 +0000 Subject: [PATCH 4/5] Fix still broken tests --- test/hooks.bats | 1 + test/python.bats | 2 ++ 2 files changed, 3 insertions(+) diff --git a/test/hooks.bats b/test/hooks.bats index eba5962..9a5e9eb 100644 --- a/test/hooks.bats +++ b/test/hooks.bats @@ -17,6 +17,7 @@ OUT create_executable "3.5.1" "virtualenv" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/3.5.1'" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/3.5.1'" + stub pyenv-exec "python -m venv --help : true" stub pyenv-hooks "virtualenv : echo '$HOOK_PATH'/virtualenv.bash" stub pyenv-exec "echo PYENV_VERSION=3.5.1 \"\$@\"" stub pyenv-exec "echo PYENV_VERSION=3.5.1 \"\$@\"" diff --git a/test/python.bats b/test/python.bats index 47348cc..9e2589d 100644 --- a/test/python.bats +++ b/test/python.bats @@ -31,6 +31,7 @@ teardown() { create_executable "2.7.8" "python2.7" remove_executable "2.7.9" "python2.7" + stub pyenv-exec "python -m venv --help : false" stub pyenv-exec "virtualenv --verbose * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\"" stub pyenv-exec "python -s -m ensurepip : true" stub pyenv-which "python2.7 : echo ${PYENV_ROOT}/versions/2.7.8/bin/python2.7" @@ -55,6 +56,7 @@ OUT remove_executable "2.7.8" "python2.7" create_executable "2.7.9" "python2.7" + stub pyenv-exec "python -m venv --help : false" stub pyenv-exec "virtualenv --verbose * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\"" stub pyenv-exec "python -s -m ensurepip : true" stub pyenv-which "python2.7 : false" From 8c7dd0195493742811147f7422f937102e564311 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sat, 16 Jul 2016 06:50:50 +0000 Subject: [PATCH 5/5] Replaced `pyvenv` by `-m venv` --- bin/pyenv-sh-activate | 2 +- bin/pyenv-sh-deactivate | 2 +- bin/pyenv-virtualenv | 20 +++++++++---------- bin/pyenv-virtualenv-prefix | 2 +- etc/pyenv.d/which/python-config.bash | 2 +- etc/pyenv.d/which/system-site-packages.bash | 2 +- test/conda.bats | 6 +++--- test/envs.bats | 4 ++-- test/pip.bats | 8 ++++---- test/prefix.bats | 20 +++++++++---------- test/pyvenv.bats | 22 ++++++++++----------- test/test_helper.bash | 4 ++-- test/version.bats | 7 +++---- 13 files changed, 50 insertions(+), 51 deletions(-) diff --git a/bin/pyenv-sh-activate b/bin/pyenv-sh-activate index 3a8d96c..ec3454a 100755 --- a/bin/pyenv-sh-activate +++ b/bin/pyenv-sh-activate @@ -160,7 +160,7 @@ EOS IFS="$OLDIFS" fi -# virtualenv/pyvenv +# virtualenv/venv case "${shell}" in fish ) cat </dev/null || true else - if [ -n "${USE_PYVENV}" ]; then + if [ -n "${USE_M_VENV}" ]; then pyenv-exec python -m venv --help 2>/dev/null || true else pyenv-exec virtualenv --help 2>/dev/null || true @@ -142,15 +142,15 @@ detect_venv() { HAS_VIRTUALENV=1 fi if pyenv-exec python -m venv --help 1>/dev/null 2>&1; then - HAS_PYVENV=1 + HAS_M_VENV=1 fi fi # Use `python -m venv` only if there is venv available, virtualenv is not installed, and `-p` not given if [ -n "${HAS_CONDA}" ]; then USE_CONDA=1 else - if [ -n "${HAS_PYVENV}" ] && [ -z "${HAS_VIRTUALENV}" ] && [ -z "${VIRTUALENV_PYTHON}" ]; then - USE_PYVENV=1 + if [ -n "${HAS_M_VENV}" ] && [ -z "${HAS_VIRTUALENV}" ] && [ -z "${VIRTUALENV_PYTHON}" ]; then + USE_M_VENV=1 fi fi } @@ -356,9 +356,9 @@ if [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then fi unset HAS_VIRTUALENV -unset HAS_PYVENV +unset HAS_M_VENV unset USE_CONDA -unset USE_PYVENV +unset USE_M_VENV detect_venv SEED="$(date "+%Y%m%d%H%M%S").$$" @@ -369,7 +369,7 @@ REQUIREMENTS="${TMP}/requirements.${SEED}.txt" if [ -n "$UPGRADE" ]; then FORCE=1 # `python -m venv` has `--upgrade` by default - if [ -n "${USE_PYVENV}" ]; then + if [ -n "${USE_M_VENV}" ]; then unset UPGRADE VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--upgrade" fi @@ -402,7 +402,7 @@ if [ -n "${USE_CONDA}" ]; then fi fi else - if [ -n "${USE_PYVENV}" ]; then + if [ -n "${USE_M_VENV}" ]; then # Unset some arguments not supported by `python -m venv` unset QUIET unset VERBOSE @@ -521,7 +521,7 @@ cd "${PYENV_VIRTUALENV_CACHE_PATH}" if [ -n "${USE_CONDA}" ]; then pyenv-exec conda create $QUIET $VERBOSE --name "${VIRTUALENV_PATH##*/}" --yes "${VIRTUALENV_OPTIONS[@]}" python || STATUS="$?" else - if [ -n "${USE_PYVENV}" ]; then + if [ -n "${USE_M_VENV}" ]; then pyenv-exec python -m venv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" else pyenv-exec virtualenv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?" diff --git a/bin/pyenv-virtualenv-prefix b/bin/pyenv-virtualenv-prefix index c517062..934a18f 100755 --- a/bin/pyenv-virtualenv-prefix +++ b/bin/pyenv-virtualenv-prefix @@ -33,7 +33,7 @@ for version in "${versions[@]}"; do VIRTUALENV_PREFIX_PATH="${PYENV_PREFIX_PATH}" else if [ -f "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" ]; then - # pyvenv + # venv virtualenv_binpath="$(cut -b 1-1024 "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" | sed -n '/^ *home *= */s///p' || true)" VIRTUALENV_PREFIX_PATH="${virtualenv_binpath%/bin}" else diff --git a/etc/pyenv.d/which/python-config.bash b/etc/pyenv.d/which/python-config.bash index 2785f6b..a0df899 100644 --- a/etc/pyenv.d/which/python-config.bash +++ b/etc/pyenv.d/which/python-config.bash @@ -13,7 +13,7 @@ if [ ! -x "${PYENV_COMMAND_PATH}" ] && [[ "${PYENV_COMMAND_PATH##*/}" == "python : # do nothing for conda's environments else if [ -f "${PYENV_ROOT}/versions/${version}/bin/pyvenv.cfg" ]; then - # pyvenv + # venv virtualenv_binpath="$(cut -b 1-1024 "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" | sed -n '/^ *home *= */s///p' || true)" virtualenv_prefix="${virtualenv_binpath%/bin}" else diff --git a/etc/pyenv.d/which/system-site-packages.bash b/etc/pyenv.d/which/system-site-packages.bash index 8283793..ef7ad08 100644 --- a/etc/pyenv.d/which/system-site-packages.bash +++ b/etc/pyenv.d/which/system-site-packages.bash @@ -14,7 +14,7 @@ if [ ! -x "${PYENV_COMMAND_PATH}" ]; then : # do nothing for conda's environments else if [ -f "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" ]; then - # pyvenv + # venv virtualenv_binpath="$(cut -b 1-1024 "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" | sed -n '/^ *home *= */s///p' || true)" virtualenv_prefix="${virtualenv_binpath%/bin}" if grep -q -i "include-system-site-packages *= *true" "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" 1>/dev/null 2>&1; then diff --git a/test/conda.bats b/test/conda.bats index 3c6ef02..43a7bf6 100644 --- a/test/conda.bats +++ b/test/conda.bats @@ -40,7 +40,7 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "miniconda3-3.16.0" + teardown_m_venv "miniconda3-3.16.0" } @test "create virtualenv by conda create with -p" { @@ -63,7 +63,7 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "miniconda3-3.16.0" + teardown_m_venv "miniconda3-3.16.0" } @test "create virtualenv by conda create with --python" { @@ -86,5 +86,5 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "miniconda3-3.16.0" + teardown_m_venv "miniconda3-3.16.0" } diff --git a/test/envs.bats b/test/envs.bats index 3dcc703..325aa33 100644 --- a/test/envs.bats +++ b/test/envs.bats @@ -20,7 +20,7 @@ unstub_pyenv() { @test "path should be handled properly even if there is 'envs' in PYENV_ROOT" { export PYENV_VERSION="3.5.1" - setup_pyvenv "3.5.1" + setup_m_venv "3.5.1" stub_pyenv "${PYENV_VERSION}" stub pyenv-version-name "echo '${PYENV_VERSION}'" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" @@ -43,5 +43,5 @@ OUT unstub pyenv-version-name unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.5.1" + teardown_m_venv "3.5.1" } diff --git a/test/pip.bats b/test/pip.bats index 6e31f24..88aa7b7 100644 --- a/test/pip.bats +++ b/test/pip.bats @@ -22,7 +22,7 @@ unstub_pyenv() { @test "install pip with ensurepip" { export PYENV_VERSION="3.5.1" - setup_pyvenv "3.5.1" + setup_m_venv "3.5.1" stub_pyenv "${PYENV_VERSION}" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-virtualenv-prefix " : false" @@ -43,12 +43,12 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.5.1" + teardown_m_venv "3.5.1" } @test "install pip without using ensurepip" { export PYENV_VERSION="3.3.6" - setup_pyvenv "3.3.6" + setup_m_venv "3.3.6" stub_pyenv "${PYENV_VERSION}" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-virtualenv-prefix " : false" @@ -72,5 +72,5 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.3.6" + teardown_m_venv "3.3.6" } diff --git a/test/prefix.bats b/test/prefix.bats index 471d6b2..a21c3f9 100644 --- a/test/prefix.bats +++ b/test/prefix.bats @@ -45,14 +45,14 @@ remove_virtualenv() { remove_version "${2:-$1}" } -create_pyvenv() { +create_m_venv() { create_version "$1" create_version "${2:-$1}" echo "home = ${PYENV_ROOT}/versions/${2:-$1}/bin" > "${PYENV_ROOT}/versions/$1/pyvenv.cfg" touch "${PYENV_ROOT}/versions/$1/bin/activate" } -remove_pyvenv() { +remove_m_venv() { remove_version "${2:-$1}" } @@ -141,10 +141,10 @@ OUT remove_virtualenv "bar" "3.5.1" } -@test "display prefix of virtualenv created by pyvenv" { +@test "display prefix of virtualenv created by venv" { stub pyenv-version-name "echo foo" stub pyenv-prefix "foo : echo \"${PYENV_ROOT}/versions/foo\"" - create_pyvenv "foo" "3.3.6" + create_m_venv "foo" "3.3.6" PYENV_VERSION="foo" run pyenv-virtualenv-prefix @@ -155,15 +155,15 @@ OUT unstub pyenv-version-name unstub pyenv-prefix - remove_pyvenv "foo" "3.3.6" + remove_m_venv "foo" "3.3.6" } -@test "display prefixes of virtualenv created by pyvenv" { +@test "display prefixes of virtualenv created by venv" { stub pyenv-version-name "echo foo:bar" stub pyenv-prefix "foo : echo \"${PYENV_ROOT}/versions/foo\"" \ "bar : echo \"${PYENV_ROOT}/versions/bar\"" - create_pyvenv "foo" "3.3.6" - create_pyvenv "bar" "3.4.4" + create_m_venv "foo" "3.3.6" + create_m_venv "bar" "3.4.4" PYENV_VERSION="foo:bar" run pyenv-virtualenv-prefix @@ -174,8 +174,8 @@ OUT unstub pyenv-version-name unstub pyenv-prefix - remove_pyvenv "foo" "3.3.6" - remove_pyvenv "bar" "3.4.4" + remove_m_venv "foo" "3.3.6" + remove_m_venv "bar" "3.4.4" } @test "display prefix of virtualenv created by conda" { diff --git a/test/pyvenv.bats b/test/pyvenv.bats index 082f62a..d5637cd 100644 --- a/test/pyvenv.bats +++ b/test/pyvenv.bats @@ -20,9 +20,9 @@ unstub_pyenv() { unstub pyenv-rehash } -@test "use pyvenv if virtualenv is not available" { +@test "use venv if virtualenv is not available" { export PYENV_VERSION="3.5.1" - setup_pyvenv "3.5.1" + setup_m_venv "3.5.1" stub_pyenv "${PYENV_VERSION}" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-virtualenv-prefix " : false" @@ -41,12 +41,12 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.5.1" + teardown_m_venv "3.5.1" } -@test "not use pyvenv if virtualenv is available" { +@test "not use venv if virtualenv is available" { export PYENV_VERSION="3.5.1" - setup_pyvenv "3.5.1" + setup_m_venv "3.5.1" create_executable "3.5.1" "virtualenv" stub_pyenv "${PYENV_VERSION}" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" @@ -66,10 +66,10 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.5.1" + teardown_m_venv "3.5.1" } -@test "install virtualenv if pyvenv is not avaialble" { +@test "install virtualenv if venv is not avaialble" { export PYENV_VERSION="3.2.1" setup_version "3.2.1" stub_pyenv "${PYENV_VERSION}" @@ -96,7 +96,7 @@ OUT @test "install virtualenv if -p has given" { export PYENV_VERSION="3.5.1" - setup_pyvenv "3.5.1" + setup_m_venv "3.5.1" stub_pyenv "${PYENV_VERSION}" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-virtualenv-prefix " : false" @@ -117,12 +117,12 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.5.1" + teardown_m_venv "3.5.1" } @test "install virtualenv if --python has given" { export PYENV_VERSION="3.5.1" - setup_pyvenv "3.5.1" + setup_m_venv "3.5.1" stub_pyenv "${PYENV_VERSION}" stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-virtualenv-prefix " : false" @@ -143,7 +143,7 @@ OUT unstub_pyenv unstub pyenv-virtualenv-prefix unstub pyenv-exec - teardown_pyvenv "3.5.1" + teardown_m_venv "3.5.1" } @test "install virtualenv with unsetting troublesome pip options" { diff --git a/test/test_helper.bash b/test/test_helper.bash index f419d42..78a4f28 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -137,13 +137,13 @@ teardown_virtualenv() { rm -fr "${PYENV_ROOT}/versions/$1" } -setup_pyvenv() { +setup_m_venv() { create_executable "$1" "python" create_executable "$1" "activate" remove_executable "$1" "conda" } -teardown_pyvenv() { +teardown_m_venv() { rm -fr "${PYENV_ROOT}/versions/$1" } diff --git a/test/version.bats b/test/version.bats index 7384958..67efd28 100644 --- a/test/version.bats +++ b/test/version.bats @@ -22,11 +22,10 @@ setup() { teardown_virtualenv "2.7.7" } -@test "display pyvenv version" { - setup_pyvenv "3.4.1" +@test "display venv version" { + setup_m_venv "3.4.1" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/3.4.1'" stub pyenv-exec "python -m venv --help : true" - stub pyenv-which "pyvenv : echo \"${PYENV_ROOT}/versions/3.4.1/bin/pyvenv\"" run pyenv-virtualenv --version @@ -34,5 +33,5 @@ setup() { [[ "$output" == "pyenv-virtualenv 20"*" (python -m venv)" ]] unstub pyenv-prefix - teardown_pyvenv "3.4.1" + teardown_m_venv "3.4.1" }