File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -310,6 +310,10 @@ else
310
310
VIRTUALENV_NAME=" ${ARGUMENTS[1]} "
311
311
fi
312
312
313
+ if [[ -n " ${VERSION_NAME} " ]] && command -v pyenv-latest > /dev/null; then
314
+ VERSION_NAME=" $( pyenv-latest -q " ${VERSION_NAME} " || echo " ${VERSION_NAME} " ) "
315
+ fi
316
+
313
317
if [ -z " ${VERSION_NAME} " ] || [ -z " ${VIRTUALENV_NAME} " ]; then
314
318
usage 1
315
319
fi
Original file line number Diff line number Diff line change 50
50
unstub curl
51
51
}
52
52
53
+ @test " create virtualenv from a given prefix" {
54
+ stub_pyenv " 2.7.11"
55
+ stub pyenv-virtualenv-prefix " : false"
56
+ stub pyenv-exec " python2.7 -m venv --help : false"
57
+ stub pyenv-exec " python2 -m venv --help : false"
58
+ stub pyenv-exec " python -m venv --help : false"
59
+ stub pyenv-exec " virtualenv * : echo PYENV_VERSION=\$ {PYENV_VERSION} \"\$ @\" "
60
+ stub pyenv-exec " python -s -m ensurepip : false"
61
+ stub pyenv-exec " python -s */get-pip.py : true"
62
+ stub curl true
63
+ stub pyenv-latest " -q 2.7 : echo 2.7.11"
64
+
65
+ run pyenv-virtualenv " 2.7" " venv"
66
+
67
+ assert_output << OUT
68
+ PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT} /versions/2.7.11/envs/venv
69
+ Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
70
+ rehashed
71
+ OUT
72
+ assert [ -x " ${PYENV_ROOT} /versions/2.7.11/envs/venv/bin/pydoc" ]
73
+ assert [ ! -e " ${PYENV_ROOT} /versions/2.7" ]
74
+ assert_success
75
+
76
+ unstub_pyenv
77
+ unstub pyenv-virtualenv-prefix
78
+ unstub pyenv-exec
79
+ unstub curl
80
+ }
81
+
53
82
@test " create virtualenv from current version" {
54
83
export PYENV_VERSION=" 2.7.11"
55
84
stub_pyenv " ${PYENV_VERSION} "
You can’t perform that action at this time.
0 commit comments