Skip to content

Commit

Permalink
Make sure pydoc executable exists after creating virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
yyuu committed Aug 23, 2017
1 parent e339fde commit 927914b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
16 changes: 11 additions & 5 deletions test/pyvenv.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ unstub_pyenv() {

run pyenv-virtualenv venv

assert_success
assert_output <<OUT
PYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-virtualenv-prefix
Expand All @@ -57,19 +58,20 @@ OUT

run pyenv-virtualenv venv

assert_success
assert_output <<OUT
PYENV_VERSION=3.5.1 virtualenv ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-virtualenv-prefix
unstub pyenv-exec
teardown_m_venv "3.5.1"
}

@test "install virtualenv if venv is not avaialble" {
@test "install virtualenv if venv is not available" {
export PYENV_VERSION="3.2.1"
setup_version "3.2.1"
stub_pyenv "${PYENV_VERSION}"
Expand All @@ -81,12 +83,13 @@ OUT

run pyenv-virtualenv venv

assert_success
assert_output <<OUT
PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2
PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-virtualenv-prefix
Expand All @@ -112,6 +115,7 @@ PYENV_VERSION=3.5.1 pip install virtualenv
PYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
Expand All @@ -138,6 +142,7 @@ PYENV_VERSION=3.5.1 pip install virtualenv
PYENV_VERSION=3.5.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.5.1/envs/venv
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
Expand All @@ -158,12 +163,13 @@ OUT

PIP_REQUIRE_VENV="true" run pyenv-virtualenv venv

assert_success
assert_output <<OUT
PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 pip install virtualenv==13.1.2
PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-virtualenv-prefix
Expand Down
11 changes: 8 additions & 3 deletions test/virtualenv.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ unstub_pyenv() {

run pyenv-virtualenv "2.7.11" "venv"

assert_success
assert_output <<OUT
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-virtualenv-prefix
Expand All @@ -60,12 +61,13 @@ OUT

run pyenv-virtualenv venv

assert_success
assert_output <<OUT
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-version-name
Expand All @@ -92,6 +94,7 @@ PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/v
Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
Expand Down Expand Up @@ -119,6 +122,7 @@ PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/v
Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
assert_success

unstub_pyenv
Expand Down Expand Up @@ -176,12 +180,13 @@ OUT

run pyenv-virtualenv "2.7.11" "2.7.11/envs/foo"

assert_success
assert_output <<OUT
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/foo
Installing pip from https://bootstrap.pypa.io/get-pip.py...
rehashed
OUT
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/foo/bin/pydoc" ]
assert_success

unstub_pyenv
unstub pyenv-virtualenv-prefix
Expand Down

0 comments on commit 927914b

Please sign in to comment.