mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Compare commits
82 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42f8ed2dce | ||
|
|
a75aa66490 | ||
|
|
9a03eb5b9c | ||
|
|
e67dd07f1b | ||
|
|
077edc3b4d | ||
|
|
0b24ff557e | ||
|
|
6a3172ff47 | ||
|
|
894d4af8a3 | ||
|
|
980159f221 | ||
|
|
051cd5880c | ||
|
|
cfb8691fc5 | ||
|
|
74ff2ce7af | ||
|
|
b1d0d72343 | ||
|
|
219a527a78 | ||
|
|
393bcc36b8 | ||
|
|
5419dc7320 | ||
|
|
94b2c9d5d6 | ||
|
|
e690650fd6 | ||
|
|
74bc08b7dc | ||
|
|
a22521e946 | ||
|
|
b4eb09d1dd | ||
|
|
52cb0b1086 | ||
|
|
1e66783091 | ||
|
|
b8dd4fcb53 | ||
|
|
4c8da67f02 | ||
|
|
c2ba4952ff | ||
|
|
927914b25f | ||
|
|
e339fde2f3 | ||
|
|
e83a1f12c2 | ||
|
|
2727087757 | ||
|
|
f64c8ed0dd | ||
|
|
e4d2c367cc | ||
|
|
c67762742a | ||
|
|
1593b0e6b0 | ||
|
|
862be21a32 | ||
|
|
252d6763f9 | ||
|
|
832244fe13 | ||
|
|
61a5c7f807 | ||
|
|
304dff741f | ||
|
|
53dd8bcf46 | ||
|
|
f9b1814b82 | ||
|
|
a3bc42cb93 | ||
|
|
0fd8a161e6 | ||
|
|
704f08f866 | ||
|
|
8c7dd01954 | ||
|
|
99a90ab774 | ||
|
|
187156d600 | ||
|
|
7dc9f78589 | ||
|
|
24b494a858 | ||
|
|
1488c3ed65 | ||
|
|
5c2d7dc291 | ||
|
|
f58bdb5cd5 | ||
|
|
d9391b4fb9 | ||
|
|
d6bc583753 | ||
|
|
98bb240843 | ||
|
|
1cb6bb06ef | ||
|
|
08cfea259c | ||
|
|
c64aebef08 | ||
|
|
b952f573ba | ||
|
|
62e32f9cb3 | ||
|
|
8ab4463d80 | ||
|
|
34dc769a5d | ||
|
|
16597f0bb8 | ||
|
|
fa0876685e | ||
|
|
ab5b5b9221 | ||
|
|
f627609419 | ||
|
|
23f7027ce4 | ||
|
|
55f7e3e1e1 | ||
|
|
d26852e274 | ||
|
|
7938c89aff | ||
|
|
1ce2e2d730 | ||
|
|
d3d6504e01 | ||
|
|
15981986e5 | ||
|
|
ddda0d7200 | ||
|
|
4f39ac4623 | ||
|
|
dbbbc33206 | ||
|
|
17ee6e72b6 | ||
|
|
1f761275cd | ||
|
|
51ebc8ff8a | ||
|
|
4c8eeebbff | ||
|
|
433992e376 | ||
|
|
efe6d6757c |
@@ -5,3 +5,9 @@ language: c
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: DsGAt0UmTSGVfsNJ6LmM+LvsV6FYmvX4FcET82XrskPiQW+N8+8JZR8WuZxfmwdJZu+dkkdoq6gYgL2xF7m4LxRG7aw3B5TtbMTrJQeW0hdtCSBwbbYyvwcp2m7ywE8lGAfZQITaGj1R6f2Cgh8cgtcrErjcF0KJsYlVlgNv+/M=
|
||||
on:
|
||||
tags: true
|
||||
|
||||
41
CHANGELOG.md
41
CHANGELOG.md
@@ -1,5 +1,44 @@
|
||||
## Version History
|
||||
|
||||
#### 1.1.2
|
||||
|
||||
* Use custom get-pip URL based on the target version (#253, #254, #255)
|
||||
* Source conda 4.4.4 shell files (#251)
|
||||
* Evaluate force flag before testing if venv exists (#232)
|
||||
|
||||
#### 1.1.1
|
||||
|
||||
* Set `CONDA_PREFIX` to make is useable in conda activate/deactivate scripts (#224)
|
||||
* Generate `pydoc` executable after creating new virtualenv (#197, #230)
|
||||
|
||||
#### 1.1.0
|
||||
|
||||
* fish: use "set -gx" instead of "setenv" (#215, #216, #217, #218)
|
||||
|
||||
#### 1.0.0
|
||||
|
||||
* Use similar versioning scheme as pyenv; YYYYMMDD -> X.Y.Z
|
||||
|
||||
#### 20160716
|
||||
|
||||
* Suppress activate/deactivate messages by default (#169, #170, #171)
|
||||
* Source conda package activate/deactivat scripts if exist (#173)
|
||||
* Use `source` in favor of `.` for `fish` (#175)
|
||||
* Use `python -m venv` instead of `pyvenv` due to deprecation of `pyvenv` after 3.6 (#184, #185)
|
||||
|
||||
#### 20160315
|
||||
|
||||
* Evaluate `${PATH}` when outputted code is eval'd. (#154)
|
||||
* Set proper `CONDA_DEFAULT_ENV` for shorter name (#160)
|
||||
|
||||
#### 20160202
|
||||
|
||||
* Install virtualenv 13.1.2 for CPython/Stackless 3.2.x (yyuu/pyenv#531)
|
||||
|
||||
#### 20160112
|
||||
|
||||
* Fix problem with `virtualenv` to look up executables from source version with `--system-site-packages` (#62)
|
||||
|
||||
#### 20151229
|
||||
|
||||
* Fix `deactivate` error on `fish` (#136)
|
||||
@@ -9,7 +48,7 @@
|
||||
* Improved interoperability with Anaconda/Miniconda (#103, #106, #107, #108)
|
||||
* Create `virtualenv` inside `envs` directory of source version, like Anaconda/Miniconda (#103, #107)
|
||||
* Rewrite `pyenv activate` and `pyenv deactivate` without using scripts provided by virtualenv and conda (#51, #69, #103, #104, #121)
|
||||
* Improve the `pyenv activate` behaviour on multipe versions (#105, #111)
|
||||
* Improve the `pyenv activate` behaviour on multiple versions (#105, #111)
|
||||
* Reject creating a virtualenv named `system` (yyuu/pyenv#475)
|
||||
* Add `--skip-aliases` to `pyenv virtualenvs` (#120)
|
||||
* Stop showing `version not installed` warning messages in precmd (#49)
|
||||
|
||||
48
README.md
48
README.md
@@ -2,14 +2,14 @@
|
||||
|
||||
[](https://gitter.im/yyuu/pyenv-virtualenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
[](https://travis-ci.org/yyuu/pyenv-virtualenv)
|
||||
[](https://travis-ci.org/pyenv/pyenv-virtualenv)
|
||||
|
||||
pyenv-virtualenv is a [pyenv](https://github.com/yyuu/pyenv) plugin
|
||||
pyenv-virtualenv is a [pyenv](https://github.com/pyenv/pyenv) plugin
|
||||
that provides features to manage virtualenvs and conda environments
|
||||
for Python on UNIX-like systems.
|
||||
|
||||
(NOTICE: If you are an existing user of [virtualenvwrapper](http://pypi.python.org/pypi/virtualenvwrapper)
|
||||
and you love it, [pyenv-virtualenvwrapper](https://github.com/yyuu/pyenv-virtualenvwrapper) may help you
|
||||
and you love it, [pyenv-virtualenvwrapper](https://github.com/pyenv/pyenv-virtualenvwrapper) may help you
|
||||
(additionally) to manage your virtualenvs.)
|
||||
|
||||
## Installation
|
||||
@@ -17,7 +17,7 @@ and you love it, [pyenv-virtualenvwrapper](https://github.com/yyuu/pyenv-virtual
|
||||
### Installing as a pyenv plugin
|
||||
|
||||
This will install the latest development version of pyenv-virtualenv into
|
||||
the `~/.pyenv/plugins/pyenv-virtualenv` directory.
|
||||
the `$(pyenv root)/plugins/pyenv-virtualenv` directory.
|
||||
|
||||
**Important note:** If you installed pyenv into a non-standard directory, make
|
||||
sure that you clone this repo into the 'plugins' directory of wherever you
|
||||
@@ -31,16 +31,23 @@ From inside that directory you can:
|
||||
1. **Check out pyenv-virtualenv into plugin directory**
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
|
||||
$ 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 virtualenv. This is entirely optional but pretty useful.
|
||||
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
|
||||
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
|
||||
```
|
||||
|
||||
**Fish shell note**: Add this to your `~/.config/fish/config.fish`
|
||||
|
||||
```sh
|
||||
status --is-interactive; and source (pyenv virtualenv-init -|psub)
|
||||
```
|
||||
|
||||
**Zsh note**: Modify your `~/.zshenv` file instead of `~/.bash_profile`.
|
||||
|
||||
**Pyenv note**: You may also need to add `eval "$(pyenv init -)"` to your profile if you haven't done so already.
|
||||
|
||||
3. **Restart your shell to enable pyenv-virtualenv**
|
||||
@@ -90,7 +97,7 @@ of the virtualenv directory. For example,
|
||||
$ pyenv virtualenv 2.7.10 my-virtual-env-2.7.10
|
||||
```
|
||||
|
||||
will create a virtualenv based on Python 2.7.10 under `~/.pyenv/versions` in a
|
||||
will create a virtualenv based on Python 2.7.10 under `$(pyenv root)/versions` in a
|
||||
folder called `my-virtual-env-2.7.10`.
|
||||
|
||||
|
||||
@@ -111,22 +118,25 @@ $ pyenv virtualenv venv34
|
||||
`pyenv virtualenvs` shows you the list of existing virtualenvs and `conda` environments.
|
||||
|
||||
```sh
|
||||
$ pyenv shell venv27
|
||||
$ pyenv shell venv34
|
||||
$ pyenv virtualenvs
|
||||
miniconda3-3.9.1 (created from /home/yyuu/.pyenv/versions/miniconda3-3.9.1)
|
||||
miniconda3-3.9.1/envs/myenv (created from /home/yyuu/.pyenv/versions/miniconda3-3.9.1)
|
||||
* venv27 (created from /home/yyuu/.pyenv/versions/2.7.10)
|
||||
venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)
|
||||
2.7.10/envs/my-virtual-env-2.7.10 (created from /home/yyuu/.pyenv/versions/2.7.10)
|
||||
3.4.3/envs/venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)
|
||||
my-virtual-env-2.7.10 (created from /home/yyuu/.pyenv/versions/2.7.10)
|
||||
* venv34 (created from /home/yyuu/.pyenv/versions/3.4.3)
|
||||
```
|
||||
|
||||
There are two entries for each virtualenv, and the shorter one is just a symlink.
|
||||
|
||||
|
||||
### Activate virtualenv
|
||||
|
||||
Some external tools (e.g. [jedi](https://github.com/davidhalter/jedi)) might
|
||||
require you to `activate` the virtualenv and `conda` environments.
|
||||
|
||||
`pyenv-virtualenv` will automatically activate/deactivate the virtualenv if
|
||||
the `eval "$(pyenv virtualenv-init -)"` is properly configured in your shell.
|
||||
If `eval "$(pyenv virtualenv-init -)"` is configured in your shell, `pyenv-virtualenv` will automatically activate/deactivate virtualenvs on entering/leaving directories which contain a `.python-version` file that contains the name of a valid virtual environment as shown in the output of `pyenv virtualenvs` (e.g., `venv34` or `3.4.3/envs/venv34` in example above) . `.python-version` files are used by pyenv to denote local Python versions and can be created and deleted with the [`pyenv local`](https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-local) command.
|
||||
|
||||
You can also activate and deactivate a pyenv virtualenv manually:
|
||||
|
||||
@@ -138,21 +148,21 @@ pyenv deactivate
|
||||
|
||||
### Delete existing virtualenv
|
||||
|
||||
Removing the directories in `~/.pyenv/versions` and `~/.pyenv/versions/{version}/envs` will delete the virtualenv, or you can run:
|
||||
Removing the directories in `$(pyenv root)/versions` and `$(pyenv root)/versions/{version}/envs` will delete the virtualenv, or you can run:
|
||||
|
||||
```sh
|
||||
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.
|
||||
|
||||
|
||||
@@ -212,11 +222,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.
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ resolve_link() {
|
||||
|
||||
unset FORCE
|
||||
unset QUIET
|
||||
unset VERBOSE
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
@@ -36,10 +35,6 @@ while [ $# -gt 0 ]; do
|
||||
"-f" | "--force" )
|
||||
FORCE=1
|
||||
;;
|
||||
"--no-error" )
|
||||
# for backward compatibility with v20151103 and earlier
|
||||
QUIET=1
|
||||
;;
|
||||
"-q" | "--quiet" )
|
||||
QUIET=1
|
||||
;;
|
||||
@@ -47,7 +42,8 @@ while [ $# -gt 0 ]; do
|
||||
exec pyenv-sh-deactivate
|
||||
;;
|
||||
"-v" | "--verbose" )
|
||||
VERBOSE=1
|
||||
unset QUIET
|
||||
PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1
|
||||
;;
|
||||
* )
|
||||
break
|
||||
@@ -136,9 +132,11 @@ if [[ "${VIRTUAL_ENV}" == "${prefix}" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
pyenv-sh-deactivate --force --quiet ${VERBOSE+--verbose} || true
|
||||
pyenv-sh-deactivate --force --quiet || true
|
||||
|
||||
echo "pyenv-virtualenv: activate ${venv}" 1>&2
|
||||
if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
|
||||
echo "pyenv-virtualenv: activate ${venv}" 1>&2
|
||||
fi
|
||||
|
||||
if [ -z "$no_shell" ]; then
|
||||
# shell version set in pyenv-sh-activate should be unset
|
||||
@@ -148,8 +146,8 @@ if [ -z "$no_shell" ]; then
|
||||
case "$shell" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
setenv PYENV_VERSION "${versions[*]}";
|
||||
setenv PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VERSION "${versions[*]}";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
@@ -162,12 +160,12 @@ EOS
|
||||
IFS="$OLDIFS"
|
||||
fi
|
||||
|
||||
# virtualenv/pyvenv
|
||||
# virtualenv/venv
|
||||
case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
setenv PYENV_VIRTUAL_ENV "${prefix}";
|
||||
setenv VIRTUAL_ENV "${prefix}";
|
||||
set -gx PYENV_VIRTUAL_ENV "${prefix}";
|
||||
set -gx VIRTUAL_ENV "${prefix}";
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
@@ -180,14 +178,14 @@ esac
|
||||
|
||||
# anaconda/miniconda
|
||||
if [ -x "${prefix}/bin/conda" ]; then
|
||||
if [[ "${venv}" != "${venv%/envs/*}" ]]; then
|
||||
if [[ "${prefix}" != "${prefix%/envs/*}" ]]; then
|
||||
CONDA_DEFAULT_ENV="${venv##*/envs/}"
|
||||
else
|
||||
CONDA_DEFAULT_ENV="root"
|
||||
fi
|
||||
case "${shell}" in
|
||||
fish )
|
||||
echo "setenv CONDA_DEFAULT_ENV \"${CONDA_DEFAULT_ENV}\";"
|
||||
echo "set -gx CONDA_DEFAULT_ENV \"${CONDA_DEFAULT_ENV}\";"
|
||||
;;
|
||||
* )
|
||||
echo "export CONDA_DEFAULT_ENV=\"${CONDA_DEFAULT_ENV}\";"
|
||||
@@ -199,7 +197,7 @@ if [ -n "${PYTHONHOME}" ]; then
|
||||
case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
setenv _OLD_VIRTUAL_PYTHONHOME "${PYTHONHOME}";
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME "${PYTHONHOME}";
|
||||
set -e PYTHONHOME;
|
||||
EOS
|
||||
;;
|
||||
@@ -218,10 +216,14 @@ PYENV_VIRTUALENV_DISABLE_PROMPT="${PYENV_VIRTUALENV_DISABLE_PROMPT:-${VIRTUAL_EN
|
||||
if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then
|
||||
case "${shell}" in
|
||||
fish )
|
||||
echo "pyenv-virtualenv: prompt changing not work for fish." 1>&2
|
||||
if [ -z "${QUIET}" ]; then
|
||||
echo "pyenv-virtualenv: prompt changing not working for fish." 1>&2
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
echo "pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior." 1>&2
|
||||
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}";
|
||||
@@ -229,3 +231,28 @@ EOS
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# conda package anaconda/miniconda scripts (#173)
|
||||
if [ -x "${prefix}/bin/conda" ]; then
|
||||
shopt -s nullglob
|
||||
case "${shell}" in
|
||||
fish )
|
||||
# conda 4.4 and above
|
||||
for script in "${prefix}/etc/fish/conf.d"/*.fish; do
|
||||
echo "source \"${script}\";"
|
||||
done
|
||||
;;
|
||||
* )
|
||||
CONDA_PREFIX="$prefix"
|
||||
echo "export CONDA_PREFIX=\"${CONDA_PREFIX}\";"
|
||||
for script in "${prefix}/etc/conda/activate.d"/*.sh; do
|
||||
echo ". \"${script}\";"
|
||||
done
|
||||
# conda 4.4 and above
|
||||
for script in "${prefix}/etc/profile.d"/*.sh; do
|
||||
echo ". \"${script}\";"
|
||||
done
|
||||
;;
|
||||
esac
|
||||
shopt -u nullglob
|
||||
fi
|
||||
|
||||
@@ -15,22 +15,18 @@ fi
|
||||
|
||||
unset FORCE
|
||||
unset QUIET
|
||||
unset VERBOSE
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
"-f" | "--force" )
|
||||
FORCE=1
|
||||
;;
|
||||
"--no-error" )
|
||||
# for backward compatibility with v20151103 and earlier
|
||||
QUIET=1
|
||||
;;
|
||||
"-q" | "--quiet")
|
||||
QUIET=1
|
||||
;;
|
||||
"-v" | "--verbose" )
|
||||
VERBOSE=1
|
||||
unset QUIET
|
||||
PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1
|
||||
;;
|
||||
* )
|
||||
break
|
||||
@@ -58,7 +54,26 @@ else
|
||||
venv="${prefix##*/}"
|
||||
fi
|
||||
|
||||
echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
|
||||
if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
|
||||
echo "pyenv-virtualenv: deactivate ${venv}" 1>&2
|
||||
fi
|
||||
|
||||
# conda package anaconda/miniconda scripts (#173)
|
||||
if [ -x "${prefix}/bin/conda" ]; then
|
||||
shopt -s nullglob
|
||||
case "${shell}" in
|
||||
fish )
|
||||
: # conda doesn't support fish
|
||||
;;
|
||||
* )
|
||||
for script in "${prefix}/etc/conda/deactivate.d"/*.sh; do
|
||||
echo ". \"${script}\";"
|
||||
done
|
||||
echo "unset CONDA_PREFIX"
|
||||
;;
|
||||
esac
|
||||
shopt -u nullglob
|
||||
fi
|
||||
|
||||
if [ -n "${PYENV_ACTIVATE_SHELL}" ]; then
|
||||
# shell version set in pyenv-sh-activate should be unset
|
||||
@@ -79,7 +94,7 @@ EOS
|
||||
esac
|
||||
fi
|
||||
|
||||
# virtualenv/pyvenv
|
||||
# virtualenv/venv
|
||||
case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
@@ -111,7 +126,7 @@ case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
EOS
|
||||
@@ -130,7 +145,7 @@ case "${shell}" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
EOS
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# -f/--force Install even if the version appears to be installed already
|
||||
#
|
||||
|
||||
PYENV_VIRTUALENV_VERSION="20151229"
|
||||
PYENV_VIRTUALENV_VERSION="1.1.3"
|
||||
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
@@ -107,11 +107,8 @@ version() {
|
||||
version="$(pyenv-exec conda --version 2>/dev/null || true)"
|
||||
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})"
|
||||
if [ -n "$USE_M_VENV" ]; then
|
||||
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})"
|
||||
@@ -125,8 +122,8 @@ usage() {
|
||||
if [ -n "${USE_CONDA}" ]; then
|
||||
pyenv-exec conda create --help 2>/dev/null || true
|
||||
else
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
pyenv-exec pyvenv --help 2>/dev/null || true
|
||||
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
|
||||
fi
|
||||
@@ -144,16 +141,16 @@ detect_venv() {
|
||||
if [ -x "${prefix}/bin/virtualenv" ]; then
|
||||
HAS_VIRTUALENV=1
|
||||
fi
|
||||
if [ -x "${prefix}/bin/pyvenv" ]; then
|
||||
HAS_PYVENV=1
|
||||
if pyenv-exec python -m venv --help 1>/dev/null 2>&1; then
|
||||
HAS_M_VENV=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
|
||||
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
|
||||
}
|
||||
@@ -165,7 +162,7 @@ build_package_ez_setup() {
|
||||
echo "Installing setuptools from ${EZ_SETUP}..." 1>&2
|
||||
cat "${EZ_SETUP}"
|
||||
else
|
||||
[ -n "${EZ_SETUP_URL}" ] || EZ_SETUP_URL="https://bootstrap.pypa.io/ez_setup.py"
|
||||
[ -n "${EZ_SETUP_URL}" ]
|
||||
echo "Installing setuptools from ${EZ_SETUP_URL}..." 1>&2
|
||||
http get "${EZ_SETUP_URL}"
|
||||
fi
|
||||
@@ -183,7 +180,7 @@ build_package_get_pip() {
|
||||
echo "Installing pip from ${GET_PIP}..." 1>&2
|
||||
cat "${GET_PIP}"
|
||||
else
|
||||
[ -n "${GET_PIP_URL}" ] || GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
|
||||
[ -n "${GET_PIP_URL}" ]
|
||||
echo "Installing pip from ${GET_PIP_URL}..." 1>&2
|
||||
http get "${GET_PIP_URL}"
|
||||
fi
|
||||
@@ -352,16 +349,18 @@ if [[ "${VIRTUALENV_PATH/*/envs/*}" != "${PYENV_ROOT}/versions" ]]; then
|
||||
fi
|
||||
|
||||
if [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
if [ -e "${COMPAT_VIRTUALENV_PATH}" ] || [ -L "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
echo "pyenv-virtualenv: \`${COMPAT_VIRTUALENV_PATH}' already exists." 1>&2
|
||||
exit 1
|
||||
if [ -z ${FORCE} ]; then
|
||||
if [ -e "${COMPAT_VIRTUALENV_PATH}" ] || [ -L "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
echo "pyenv-virtualenv: \`${COMPAT_VIRTUALENV_PATH}' already exists." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
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").$$"
|
||||
@@ -371,13 +370,30 @@ REQUIREMENTS="${TMP}/requirements.${SEED}.txt"
|
||||
# Upgrade existing virtualenv
|
||||
if [ -n "$UPGRADE" ]; then
|
||||
FORCE=1
|
||||
# pyvenv has `--upgrade` by default
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
# `python -m venv` has `--upgrade` by default
|
||||
if [ -n "${USE_M_VENV}" ]; then
|
||||
unset UPGRADE
|
||||
VIRTUALENV_OPTIONS[${#VIRTUALENV_OPTIONS[*]}]="--upgrade"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUALENV_VERSION}" ]; then
|
||||
case "${PYENV_VERSION}" in
|
||||
"3.0"* )
|
||||
NO_ENSUREPIP=1
|
||||
;;
|
||||
"3.1"* )
|
||||
NO_ENSUREPIP=1
|
||||
;;
|
||||
"3.2"* | "stackless-3.2"* )
|
||||
# pip 8.x (bundled with virtualenv 14+) doesn't support 3.2 anymore
|
||||
# https://github.com/yyuu/pyenv/issues/531
|
||||
VIRTUALENV_VERSION="13.1.2"
|
||||
NO_ENSUREPIP=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "${USE_CONDA}" ]; then
|
||||
# e.g. `conda create -n py35 python=3.5 anaconda`
|
||||
if [ -n "${VIRTUALENV_PYTHON}" ]; then
|
||||
@@ -388,12 +404,12 @@ if [ -n "${USE_CONDA}" ]; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -n "${USE_PYVENV}" ]; then
|
||||
# Unset some arguments not supported by pyvenv
|
||||
if [ -n "${USE_M_VENV}" ]; then
|
||||
# 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
|
||||
@@ -416,8 +432,12 @@ else
|
||||
fi
|
||||
fi
|
||||
if [ -z "${HAS_VIRTUALENV}" ]; then
|
||||
VIRTUALENV_VERSION="==${VIRTUALENV_VERSION}"
|
||||
pyenv-exec pip install $QUIET $VERBOSE "virtualenv${VIRTUALENV_VERSION%==}"
|
||||
if [ -n "${VIRTUALENV_VERSION}" ]; then
|
||||
virtualenv_spec="virtualenv==${VIRTUALENV_VERSION}"
|
||||
else
|
||||
virtualenv_spec="virtualenv"
|
||||
fi
|
||||
pyenv-exec pip install $QUIET $VERBOSE "${virtualenv_spec}"
|
||||
HAS_VIRTUALENV=1
|
||||
fi
|
||||
fi
|
||||
@@ -429,11 +449,39 @@ unset VIRTUALENV_VERSION
|
||||
|
||||
|
||||
# Download specified version of ez_setup.py/get-pip.py.
|
||||
if [ -n "${SETUPTOOLS_VERSION}" ]; then
|
||||
EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py"
|
||||
if [ -z "${EZ_SETUP_URL}" ]; then
|
||||
if [ -n "${SETUPTOOLS_VERSION}" ]; then
|
||||
EZ_SETUP_URL="https://bitbucket.org/pypa/setuptools/raw/${SETUPTOOLS_VERSION}/ez_setup.py"
|
||||
unset SETUPTOOLS_VERSION
|
||||
else
|
||||
EZ_SETUP_URL="https://bootstrap.pypa.io/ez_setup.py"
|
||||
fi
|
||||
fi
|
||||
if [ -n "${PIP_VERSION}" ]; then
|
||||
GET_PIP_URL="https://raw.githubusercontent.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py"
|
||||
if [ -z "${GET_PIP_URL}" ]; then
|
||||
if [ -n "${PIP_VERSION}" ]; then
|
||||
{ colorize 1 "WARNING"
|
||||
echo ": Setting PIP_VERSION=${PIP_VERSION} is no longer supported and may cause failures during the install process."
|
||||
} 1>&2
|
||||
GET_PIP_URL="https://raw.githubusercontent.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py"
|
||||
# Unset `PIP_VERSION` from environment before invoking `get-pip.py` to deal with "ValueError: invalid truth value" (pypa/pip#4528)
|
||||
unset PIP_VERSION
|
||||
else
|
||||
# Use custom get-pip URL based on the target version (#1127)
|
||||
case "${PYENV_VERSION}" in
|
||||
2.6 | 2.6.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/2.6/get-pip.py"
|
||||
;;
|
||||
3.2 | 3.2.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/3.2/get-pip.py"
|
||||
;;
|
||||
3.3 | 3.3.* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/3.3/get-pip.py"
|
||||
;;
|
||||
* )
|
||||
GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -503,8 +551,8 @@ 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
|
||||
pyenv-exec pyvenv $QUIET $VERBOSE "${VIRTUALENV_OPTIONS[@]}" "${VIRTUALENV_PATH}" || STATUS="$?"
|
||||
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="$?"
|
||||
fi
|
||||
@@ -515,6 +563,17 @@ if [ -d "${VIRTUALENV_PATH}" ] && [ -n "${COMPAT_VIRTUALENV_PATH}" ]; then
|
||||
ln -fs "${VIRTUALENV_PATH}" "${COMPAT_VIRTUALENV_PATH}"
|
||||
fi
|
||||
|
||||
if [ ! -e "${VIRTUALENV_PATH}/bin/pydoc" ]; then
|
||||
mkdir -p "${VIRTUALENV_PATH}/bin"
|
||||
cat <<EOS > "${VIRTUALENV_PATH}/bin/pydoc"
|
||||
#!${VIRTUALENV_PATH}/bin/python
|
||||
import pydoc
|
||||
if __name__ == '__main__':
|
||||
pydoc.cli()
|
||||
EOS
|
||||
chmod +x "${VIRTUALENV_PATH}/bin/pydoc"
|
||||
fi
|
||||
|
||||
if [ -z "${NO_ENSUREPIP}" ]; then
|
||||
## Install setuptools and pip.
|
||||
PYENV_VERSION="${VIRTUALENV_NAME}" build_package_ensurepip
|
||||
|
||||
@@ -71,7 +71,7 @@ if [ -z "$print" ]; then
|
||||
echo
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo 'status --is-interactive; and . (pyenv virtualenv-init -|psub)'
|
||||
echo 'status --is-interactive; and source (pyenv virtualenv-init -|psub)'
|
||||
;;
|
||||
* )
|
||||
echo 'eval "$(pyenv virtualenv-init -)"'
|
||||
@@ -86,13 +86,13 @@ fi
|
||||
case "$shell" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
setenv PATH '${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims' \$PATH;
|
||||
setenv PYENV_VIRTUALENV_INIT 1;
|
||||
set -gx PATH '${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims' \$PATH;
|
||||
set -gx PYENV_VIRTUALENV_INIT 1;
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
cat <<EOS
|
||||
export PATH="${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims:${PATH}";
|
||||
export PATH="${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims:\${PATH}";
|
||||
export PYENV_VIRTUALENV_INIT=1;
|
||||
EOS
|
||||
;;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,8 +12,8 @@ if [ ! -x "${PYENV_COMMAND_PATH}" ] && [[ "${PYENV_COMMAND_PATH##*/}" == "python
|
||||
if [ -f "${PYENV_ROOT}/versions/${version}/bin/conda" ]; then
|
||||
: # do nothing for conda's environments
|
||||
else
|
||||
if [ -f "${PYENV_ROOT}/versions/${version}/bin/pyvenv.cfg" ]; then
|
||||
# pyvenv
|
||||
if [ -f "${PYENV_ROOT}/versions/${version}/pyvenv.cfg" ]; then
|
||||
# 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
|
||||
|
||||
@@ -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
|
||||
@@ -37,8 +37,12 @@ if [ ! -x "${PYENV_COMMAND_PATH}" ]; then
|
||||
if [ ! -f "${no_global_site_packages}" ]; then
|
||||
include_system_site_packages=1
|
||||
fi
|
||||
virtualenv_orig_prefix="$(find "${virtualenv_libpath}/" -maxdepth 2 -type f -and -name "orig-prefix.txt" 2>/dev/null | head -1)"
|
||||
if [ -f "${virtualenv_orig_prefix}" ]; then
|
||||
virtualenv_prefix="$(cat "${virtualenv_orig_prefix}" 2>/dev/null || true)"
|
||||
fi
|
||||
fi
|
||||
if [ -n "${include_system_site_packages}" ]; then
|
||||
if [ -n "${include_system_site_packages}" ] && [ -n "${virtualenv_prefix}" ]; then
|
||||
# virtualenv is created with `--system-site-packages`
|
||||
virtualenv_command_path="${virtualenv_prefix}/bin/${PYENV_COMMAND_PATH##*/}"
|
||||
if [ -x "${virtualenv_command_path}" ]; then
|
||||
|
||||
@@ -11,6 +11,7 @@ setup() {
|
||||
unset CONDA_DEFAULT_ENV
|
||||
unset PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
|
||||
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
@@ -30,7 +31,6 @@ setup() {
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
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.
|
||||
@@ -44,13 +44,39 @@ EOS
|
||||
unstub pyenv-sh-deactivate
|
||||
}
|
||||
|
||||
@test "activate virtualenv from current version (verbose)" {
|
||||
@test "activate virtualenv from current version (quiet)" {
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
|
||||
stub pyenv-version-name "echo venv"
|
||||
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||
stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||
stub pyenv-sh-deactivate "--force --quiet --verbose : echo deactivated"
|
||||
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
|
||||
|
||||
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate --quiet
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
export _OLD_VIRTUAL_PS1="\${PS1}";
|
||||
export PS1="(venv) \${PS1}";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-prefix
|
||||
unstub pyenv-sh-deactivate
|
||||
}
|
||||
|
||||
@test "activate virtualenv from current version (verbose)" {
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1
|
||||
|
||||
stub pyenv-version-name "echo venv"
|
||||
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||
stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||
stub pyenv-sh-deactivate "--force --quiet : echo deactivated"
|
||||
|
||||
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate --verbose
|
||||
|
||||
@@ -84,7 +110,6 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv
|
||||
export PYENV_VERSION="venv";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv";
|
||||
@@ -113,10 +138,9 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv
|
||||
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing not work for fish.
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -138,12 +162,11 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv
|
||||
setenv PYENV_VERSION "venv";
|
||||
setenv PYENV_ACTIVATE_SHELL 1;
|
||||
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing not work for fish.
|
||||
set -gx PYENV_VERSION "venv";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -164,7 +187,6 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv27
|
||||
export PYENV_VERSION="venv27";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
@@ -191,7 +213,6 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv27
|
||||
export PYENV_VERSION="venv27";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
@@ -218,12 +239,11 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv27
|
||||
setenv PYENV_VERSION "venv27";
|
||||
setenv PYENV_ACTIVATE_SHELL 1;
|
||||
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing not work for fish.
|
||||
set -gx PYENV_VERSION "venv27";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -243,12 +263,11 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv27
|
||||
setenv PYENV_VERSION "venv27";
|
||||
setenv PYENV_ACTIVATE_SHELL 1;
|
||||
setenv PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
setenv VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing not work for fish.
|
||||
set -gx PYENV_VERSION "venv27";
|
||||
set -gx PYENV_ACTIVATE_SHELL 1;
|
||||
set -gx PYENV_VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
set -gx VIRTUAL_ENV "${PYENV_ROOT}/versions/venv27";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -362,12 +381,11 @@ EOS
|
||||
stub pyenv-virtualenv-prefix "2.7.10 : false"
|
||||
stub pyenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/venv27\""
|
||||
|
||||
run pyenv-sh-activate "venv27" "2.7.10"
|
||||
PYENV_SHELL="bash" run pyenv-sh-activate "venv27" "2.7.10"
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate venv27
|
||||
export PYENV_VERSION="venv27:2.7.10";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv27";
|
||||
|
||||
@@ -12,6 +12,7 @@ setup() {
|
||||
unset CONDA_DEFAULT_ENV
|
||||
unset PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
|
||||
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
@@ -32,13 +33,13 @@ setup() {
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate anaconda-2.3.0
|
||||
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";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -62,11 +63,10 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate anaconda-2.3.0
|
||||
setenv PYENV_VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
setenv VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
setenv CONDA_DEFAULT_ENV "root";
|
||||
pyenv-virtualenv: prompt changing not work for fish.
|
||||
set -gx PYENV_VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
set -gx VIRTUAL_ENV "${TMP}/pyenv/versions/anaconda-2.3.0";
|
||||
set -gx CONDA_DEFAULT_ENV "root";
|
||||
pyenv-virtualenv: prompt changing not working for fish.
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -90,7 +90,6 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate miniconda-3.9.1
|
||||
export PYENV_VERSION="miniconda-3.9.1";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1";
|
||||
@@ -99,6 +98,7 @@ 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";
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
@@ -122,13 +122,14 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate anaconda-2.3.0/envs/foo
|
||||
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";
|
||||
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/activate.d/activate.sh";
|
||||
EOS
|
||||
|
||||
unstub pyenv-version-name
|
||||
@@ -152,7 +153,6 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
deactivated
|
||||
pyenv-virtualenv: activate miniconda-3.9.1/envs/bar
|
||||
export PYENV_VERSION="miniconda-3.9.1/envs/bar";
|
||||
export PYENV_ACTIVATE_SHELL=1;
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar";
|
||||
@@ -161,6 +161,8 @@ 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";
|
||||
. "${PYENV_ROOT}/versions/miniconda-3.9.1/envs/bar/etc/conda/activate.d/activate.sh";
|
||||
EOS
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
|
||||
@@ -11,6 +11,7 @@ setup() {
|
||||
unset CONDA_DEFAULT_ENV
|
||||
unset PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
|
||||
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
@@ -29,7 +30,7 @@ setup() {
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate anaconda-2.3.0
|
||||
unset CONDA_PREFIX
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
unset CONDA_DEFAULT_ENV;
|
||||
@@ -65,16 +66,15 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate anaconda-2.3.0
|
||||
set -e PYENV_VIRTUAL_ENV;
|
||||
set -e VIRTUAL_ENV;
|
||||
set -e CONDA_DEFAULT_ENV;
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
if functions -q deactivate;
|
||||
@@ -97,7 +97,8 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate anaconda-2.3.0/envs/foo
|
||||
. "${PYENV_ROOT}/versions/anaconda-2.3.0/envs/foo/etc/conda/deactivate.d/deactivate.sh";
|
||||
unset CONDA_PREFIX
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
unset CONDA_DEFAULT_ENV;
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ setup() {
|
||||
unset CONDA_DEFAULT_ENV
|
||||
unset PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
unset PYENV_VIRTUALENV_VERBOSE_ACTIVATE
|
||||
unset PYENV_VIRTUALENV_DISABLE_PROMPT
|
||||
unset PYENV_VIRTUAL_ENV_DISABLE_PROMPT
|
||||
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||
@@ -27,7 +28,36 @@ setup() {
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
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;
|
||||
EOS
|
||||
}
|
||||
|
||||
@test "deactivate virtualenv (quiet)" {
|
||||
export PYENV_VIRTUALENV_INIT=1
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export PYENV_ACTIVATE_SHELL=
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quit
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
@@ -53,6 +83,7 @@ EOS
|
||||
export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||
export PYENV_ACTIVATE_SHELL=
|
||||
export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1
|
||||
|
||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --verbose
|
||||
|
||||
@@ -89,7 +120,6 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
@@ -120,7 +150,6 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
unset PYENV_VERSION;
|
||||
unset PYENV_ACTIVATE_SHELL;
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
@@ -153,7 +182,6 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
unset PYENV_VERSION;
|
||||
unset PYENV_ACTIVATE_SHELL;
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
@@ -186,7 +214,6 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
unset PYENV_VIRTUAL_ENV;
|
||||
unset VIRTUAL_ENV;
|
||||
if [ -n "\${_OLD_VIRTUAL_PATH}" ]; then
|
||||
@@ -217,15 +244,14 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
set -e PYENV_VIRTUAL_ENV;
|
||||
set -e VIRTUAL_ENV;
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
if functions -q deactivate;
|
||||
@@ -244,15 +270,14 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
set -e PYENV_VIRTUAL_ENV;
|
||||
set -e VIRTUAL_ENV;
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
if functions -q deactivate;
|
||||
@@ -271,17 +296,16 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
set -e PYENV_VERSION;
|
||||
set -e PYENV_ACTIVATE_SHELL;
|
||||
set -e PYENV_VIRTUAL_ENV;
|
||||
set -e VIRTUAL_ENV;
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
if functions -q deactivate;
|
||||
@@ -300,17 +324,16 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
set -e PYENV_VERSION;
|
||||
set -e PYENV_ACTIVATE_SHELL;
|
||||
set -e PYENV_VIRTUAL_ENV;
|
||||
set -e VIRTUAL_ENV;
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
if functions -q deactivate;
|
||||
@@ -329,15 +352,14 @@ EOS
|
||||
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: deactivate venv
|
||||
set -e PYENV_VIRTUAL_ENV;
|
||||
set -e VIRTUAL_ENV;
|
||||
if [ -n "\$_OLD_VIRTUAL_PATH" ];
|
||||
setenv PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -gx PATH "\$_OLD_VIRTUAL_PATH";
|
||||
set -e _OLD_VIRTUAL_PATH;
|
||||
end;
|
||||
if [ -n "\$_OLD_VIRTUAL_PYTHONHOME" ];
|
||||
setenv PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -gx PYTHONHOME "\$_OLD_VIRTUAL_PYTHONHOME";
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME;
|
||||
end;
|
||||
if functions -q deactivate;
|
||||
|
||||
@@ -23,8 +23,8 @@ setup() {
|
||||
}
|
||||
|
||||
@test "delete virtualenv by symlink" {
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||
ln -fs "${PYENV_ROOT}/versions/2.7.10/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.11/envs/venv27"
|
||||
ln -fs "${PYENV_ROOT}/versions/2.7.11/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||
|
||||
stub pyenv-rehash "true"
|
||||
|
||||
@@ -34,55 +34,55 @@ setup() {
|
||||
|
||||
unstub pyenv-rehash
|
||||
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.11/envs/venv27" ]
|
||||
[ ! -L "${PYENV_ROOT}/versions/venv27" ]
|
||||
}
|
||||
|
||||
@test "delete virtualenv with symlink" {
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||
ln -fs "${PYENV_ROOT}/versions/2.7.10/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.11/envs/venv27"
|
||||
ln -fs "${PYENV_ROOT}/versions/2.7.11/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||
|
||||
stub pyenv-rehash "true"
|
||||
|
||||
run pyenv-virtualenv-delete -f "2.7.10/envs/venv27"
|
||||
run pyenv-virtualenv-delete -f "2.7.11/envs/venv27"
|
||||
|
||||
assert_success
|
||||
|
||||
unstub pyenv-rehash
|
||||
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.11/envs/venv27" ]
|
||||
[ ! -L "${PYENV_ROOT}/versions/venv27" ]
|
||||
}
|
||||
|
||||
@test "not delete virtualenv with different symlink" {
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.8/envs/venv27"
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.11/envs/venv27"
|
||||
ln -fs "${PYENV_ROOT}/versions/2.7.8/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||
|
||||
stub pyenv-rehash "true"
|
||||
|
||||
run pyenv-virtualenv-delete -f "2.7.10/envs/venv27"
|
||||
run pyenv-virtualenv-delete -f "2.7.11/envs/venv27"
|
||||
|
||||
assert_success
|
||||
|
||||
unstub pyenv-rehash
|
||||
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.11/envs/venv27" ]
|
||||
[ -L "${PYENV_ROOT}/versions/venv27" ]
|
||||
}
|
||||
|
||||
@test "not delete virtualenv with same name" {
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||
mkdir -p "${PYENV_ROOT}/versions/2.7.11/envs/venv27"
|
||||
mkdir -p "${PYENV_ROOT}/versions/venv27"
|
||||
|
||||
stub pyenv-rehash "true"
|
||||
|
||||
run pyenv-virtualenv-delete -f "2.7.10/envs/venv27"
|
||||
run pyenv-virtualenv-delete -f "2.7.11/envs/venv27"
|
||||
|
||||
assert_success
|
||||
|
||||
unstub pyenv-rehash
|
||||
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||
[ ! -d "${PYENV_ROOT}/versions/2.7.11/envs/venv27" ]
|
||||
[ -d "${PYENV_ROOT}/versions/venv27" ]
|
||||
}
|
||||
|
||||
@@ -19,28 +19,29 @@ unstub_pyenv() {
|
||||
}
|
||||
|
||||
@test "path should be handled properly even if there is 'envs' in PYENV_ROOT" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
export PYENV_VERSION="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}'"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "pyvenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/3.4.1/envs/venv/bin"
|
||||
stub pyenv-exec "python -s -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/3.4.1/envs/venv/bin/pip"
|
||||
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 <<OUT
|
||||
PYENV_VERSION=3.4.1 pyvenv ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
PYENV_VERSION=3.4.1/envs/venv python -s -m ensurepip
|
||||
PYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv
|
||||
PYENV_VERSION=3.5.1/envs/venv python -s -m ensurepip
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.4.1/envs/venv/bin/pip" ]
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip" ]
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.5.1"
|
||||
}
|
||||
|
||||
@@ -13,22 +13,23 @@ setup() {
|
||||
before_virtualenv 'echo before: \$VIRTUALENV_PATH'
|
||||
after_virtualenv 'echo after: \$STATUS'
|
||||
OUT
|
||||
setup_version "3.2.1"
|
||||
create_executable "3.2.1" "virtualenv"
|
||||
stub pyenv-prefix "echo '${PYENV_ROOT}/versions/3.2.1'"
|
||||
stub pyenv-prefix "echo '${PYENV_ROOT}/versions/3.2.1'"
|
||||
setup_version "3.5.1"
|
||||
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.2.1 \"\$@\""
|
||||
stub pyenv-exec "echo PYENV_VERSION=3.2.1 \"\$@\""
|
||||
stub pyenv-exec "echo PYENV_VERSION=3.5.1 \"\$@\""
|
||||
stub pyenv-exec "echo PYENV_VERSION=3.5.1 \"\$@\""
|
||||
stub pyenv-rehash "echo rehashed"
|
||||
|
||||
run pyenv-virtualenv "3.2.1" venv
|
||||
run pyenv-virtualenv "3.5.1" venv
|
||||
|
||||
assert_success
|
||||
assert_output <<-OUT
|
||||
before: ${PYENV_ROOT}/versions/3.2.1/envs/venv
|
||||
PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
|
||||
PYENV_VERSION=3.2.1 python -s -m ensurepip
|
||||
before: ${PYENV_ROOT}/versions/3.5.1/envs/venv
|
||||
PYENV_VERSION=3.5.1 virtualenv ${PYENV_ROOT}/versions/3.5.1/envs/venv
|
||||
PYENV_VERSION=3.5.1 python -s -m ensurepip
|
||||
after: 0
|
||||
rehashed
|
||||
OUT
|
||||
@@ -37,5 +38,5 @@ OUT
|
||||
unstub pyenv-hooks
|
||||
unstub pyenv-exec
|
||||
unstub pyenv-rehash
|
||||
teardown_version "3.2.1"
|
||||
teardown_version "3.5.1"
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ load test_helper
|
||||
@test "fish instructions" {
|
||||
run pyenv-virtualenv-init fish
|
||||
assert [ "$status" -eq 1 ]
|
||||
assert_output_contains 'status --is-interactive; and . (pyenv virtualenv-init -|psub)'
|
||||
assert_output_contains 'status --is-interactive; and source (pyenv virtualenv-init -|psub)'
|
||||
}
|
||||
|
||||
@test "outputs bash-specific syntax" {
|
||||
@@ -50,7 +50,7 @@ load test_helper
|
||||
run pyenv-virtualenv-init - bash
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:${PATH}";
|
||||
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
|
||||
export PYENV_VIRTUALENV_INIT=1;
|
||||
_pyenv_virtualenv_hook() {
|
||||
local ret=\$?
|
||||
@@ -72,8 +72,8 @@ EOS
|
||||
run pyenv-virtualenv-init - fish
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
setenv PATH '${TMP}/pyenv/plugins/pyenv-virtualenv/shims' \$PATH;
|
||||
setenv PYENV_VIRTUALENV_INIT 1;
|
||||
set -gx PATH '${TMP}/pyenv/plugins/pyenv-virtualenv/shims' \$PATH;
|
||||
set -gx PYENV_VIRTUALENV_INIT 1;
|
||||
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
||||
set -l ret \$status
|
||||
if [ -n "\$VIRTUAL_ENV" ]
|
||||
@@ -91,7 +91,7 @@ EOS
|
||||
run pyenv-virtualenv-init - zsh
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:${PATH}";
|
||||
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
|
||||
export PYENV_VIRTUALENV_INIT=1;
|
||||
_pyenv_virtualenv_hook() {
|
||||
local ret=\$?
|
||||
|
||||
@@ -21,54 +21,56 @@ unstub_pyenv() {
|
||||
}
|
||||
|
||||
@test "install pip with ensurepip" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
export PYENV_VERSION="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"
|
||||
stub pyenv-exec "pyvenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/3.4.1/envs/venv/bin"
|
||||
stub pyenv-exec "python -s -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/3.4.1/envs/venv/bin/pip"
|
||||
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 <<OUT
|
||||
PYENV_VERSION=3.4.1 pyvenv ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
PYENV_VERSION=3.4.1/envs/venv python -s -m ensurepip
|
||||
PYENV_VERSION=3.5.1 python -m venv ${PYENV_ROOT}/versions/3.5.1/envs/venv
|
||||
PYENV_VERSION=3.5.1/envs/venv python -s -m ensurepip
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.4.1/envs/venv/bin/pip" ]
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.5.1/envs/venv/bin/pip" ]
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.5.1"
|
||||
}
|
||||
|
||||
@test "install pip without using ensurepip" {
|
||||
export PYENV_VERSION="3.3.5"
|
||||
setup_pyvenv "3.3.5"
|
||||
export PYENV_VERSION="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"
|
||||
stub pyenv-exec "pyvenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/3.3.5/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.3.6/envs/venv/bin"
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/3.3.5/envs/venv/bin/pip"
|
||||
stub pyenv-exec "python -s */get-pip.py : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/3.3.6/envs/venv/bin/pip"
|
||||
stub curl true
|
||||
|
||||
run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.3.5 pyvenv ${PYENV_ROOT}/versions/3.3.5/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
PYENV_VERSION=3.3.5/envs/venv python -s ${TMP}/pyenv/cache/get-pip.py
|
||||
PYENV_VERSION=3.3.6 python -m venv ${PYENV_ROOT}/versions/3.3.6/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/3.3/get-pip.py...
|
||||
PYENV_VERSION=3.3.6/envs/venv python -s ${TMP}/pyenv/cache/get-pip.py
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.3.5/envs/venv/bin/pip" ]
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.3.6/envs/venv/bin/pip" ]
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.3.5"
|
||||
teardown_m_venv "3.3.6"
|
||||
}
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
|
||||
@@ -73,18 +73,18 @@ remove_conda() {
|
||||
@test "display prefix of virtualenv created by virtualenv" {
|
||||
stub pyenv-version-name "echo foo"
|
||||
stub pyenv-prefix "foo : echo \"${PYENV_ROOT}/versions/foo\""
|
||||
create_virtualenv "foo" "2.7.6"
|
||||
create_virtualenv "foo" "2.7.11"
|
||||
|
||||
PYENV_VERSION="foo" run pyenv-virtualenv-prefix
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
${PYENV_ROOT}/versions/2.7.6
|
||||
${PYENV_ROOT}/versions/2.7.11
|
||||
OUT
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-prefix
|
||||
remove_virtualenv "foo" "2.7.6"
|
||||
remove_virtualenv "foo" "2.7.11"
|
||||
}
|
||||
|
||||
@test "display prefix of virtualenv created by virtualenv (pypy)" {
|
||||
@@ -125,57 +125,57 @@ OUT
|
||||
stub pyenv-version-name "echo foo:bar"
|
||||
stub pyenv-prefix "foo : echo \"${PYENV_ROOT}/versions/foo\"" \
|
||||
"bar : echo \"${PYENV_ROOT}/versions/bar\""
|
||||
create_virtualenv "foo" "2.7.6"
|
||||
create_virtualenv "bar" "3.2.1"
|
||||
create_virtualenv "foo" "2.7.11"
|
||||
create_virtualenv "bar" "3.5.1"
|
||||
|
||||
PYENV_VERSION="foo:bar" run pyenv-virtualenv-prefix
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
${PYENV_ROOT}/versions/2.7.6:${PYENV_ROOT}/versions/3.2.1
|
||||
${PYENV_ROOT}/versions/2.7.11:${PYENV_ROOT}/versions/3.5.1
|
||||
OUT
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-prefix
|
||||
remove_virtualenv "foo" "2.7.6"
|
||||
remove_virtualenv "bar" "3.2.1"
|
||||
remove_virtualenv "foo" "2.7.11"
|
||||
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.3"
|
||||
create_m_venv "foo" "3.3.6"
|
||||
|
||||
PYENV_VERSION="foo" run pyenv-virtualenv-prefix
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
${PYENV_ROOT}/versions/3.3.3
|
||||
${PYENV_ROOT}/versions/3.3.6
|
||||
OUT
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-prefix
|
||||
remove_pyvenv "foo" "3.3.3"
|
||||
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.3"
|
||||
create_pyvenv "bar" "3.4.0"
|
||||
create_m_venv "foo" "3.3.6"
|
||||
create_m_venv "bar" "3.4.4"
|
||||
|
||||
PYENV_VERSION="foo:bar" run pyenv-virtualenv-prefix
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
${PYENV_ROOT}/versions/3.3.3:${PYENV_ROOT}/versions/3.4.0
|
||||
${PYENV_ROOT}/versions/3.3.6:${PYENV_ROOT}/versions/3.4.4
|
||||
OUT
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-prefix
|
||||
remove_pyvenv "foo" "3.3.3"
|
||||
remove_pyvenv "bar" "3.4.0"
|
||||
remove_m_venv "foo" "3.3.6"
|
||||
remove_m_venv "bar" "3.4.4"
|
||||
}
|
||||
|
||||
@test "display prefix of virtualenv created by conda" {
|
||||
@@ -209,38 +209,38 @@ OUT
|
||||
}
|
||||
|
||||
@test "should fail if the version is not a virtualenv" {
|
||||
stub pyenv-version-name "echo 3.4.0"
|
||||
stub pyenv-prefix "3.4.0 : echo \"${PYENV_ROOT}/versions/3.4.0\""
|
||||
create_version "3.4.0"
|
||||
stub pyenv-version-name "echo 3.4.4"
|
||||
stub pyenv-prefix "3.4.4 : echo \"${PYENV_ROOT}/versions/3.4.4\""
|
||||
create_version "3.4.4"
|
||||
|
||||
PYENV_VERSION="3.4.0" run pyenv-virtualenv-prefix
|
||||
PYENV_VERSION="3.4.4" run pyenv-virtualenv-prefix
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
pyenv-virtualenv: version \`3.4.0' is not a virtualenv
|
||||
pyenv-virtualenv: version \`3.4.4' is not a virtualenv
|
||||
OUT
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-prefix
|
||||
remove_version "3.4.0"
|
||||
remove_version "3.4.4"
|
||||
}
|
||||
|
||||
@test "should fail if one of the versions is not a virtualenv" {
|
||||
stub pyenv-version-name "echo venv33:3.4.0"
|
||||
stub pyenv-version-name "echo venv33:3.4.4"
|
||||
stub pyenv-prefix "venv33 : echo \"${PYENV_ROOT}/versions/venv33\"" \
|
||||
"3.4.0 : echo \"${PYENV_ROOT}/versions/3.4.0\""
|
||||
create_virtualenv "venv33" "3.3.3"
|
||||
create_version "3.4.0"
|
||||
"3.4.4 : echo \"${PYENV_ROOT}/versions/3.4.4\""
|
||||
create_virtualenv "venv33" "3.3.6"
|
||||
create_version "3.4.4"
|
||||
|
||||
PYENV_VERSION="venv33:3.4.0" run pyenv-virtualenv-prefix
|
||||
PYENV_VERSION="venv33:3.4.4" run pyenv-virtualenv-prefix
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
pyenv-virtualenv: version \`3.4.0' is not a virtualenv
|
||||
pyenv-virtualenv: version \`3.4.4' is not a virtualenv
|
||||
OUT
|
||||
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-prefix
|
||||
remove_virtualenv "venv33" "3.3.3"
|
||||
remove_version "3.4.0"
|
||||
remove_virtualenv "venv33" "3.3.6"
|
||||
remove_version "3.4.4"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -20,88 +20,90 @@ unstub_pyenv() {
|
||||
unstub pyenv-rehash
|
||||
}
|
||||
|
||||
@test "use pyvenv if virtualenv is not available" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
@test "use venv if virtualenv is not available" {
|
||||
export PYENV_VERSION="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"
|
||||
stub pyenv-exec "pyvenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -m venv --help : true"
|
||||
stub pyenv-exec "python -m venv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : true"
|
||||
|
||||
run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.4.1 pyvenv ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
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
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.5.1"
|
||||
}
|
||||
|
||||
@test "not use pyvenv if virtualenv is available" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
create_executable "3.4.1" "virtualenv"
|
||||
@test "not use venv if virtualenv is available" {
|
||||
export PYENV_VERSION="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}'"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python -m venv --help : true"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : true"
|
||||
|
||||
run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.4.1 virtualenv ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
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_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.5.1"
|
||||
}
|
||||
|
||||
@test "install virtualenv if pyvenv 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}"
|
||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "pip install virtualenv* : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
stub curl true
|
||||
|
||||
run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.2.1 pip install virtualenv
|
||||
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
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc" ]
|
||||
assert_success
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
unstub curl
|
||||
teardown_version "3.2.1"
|
||||
}
|
||||
|
||||
@test "install virtualenv if -p has given" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
export PYENV_VERSION="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"
|
||||
stub pyenv-exec "python -m venv --help : true"
|
||||
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : true"
|
||||
@@ -109,24 +111,26 @@ OUT
|
||||
run pyenv-virtualenv -p ${TMP}/python3 venv
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.4.1 pip install virtualenv
|
||||
PYENV_VERSION=3.4.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
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
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.5.1"
|
||||
}
|
||||
|
||||
@test "install virtualenv if --python has given" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
export PYENV_VERSION="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"
|
||||
stub pyenv-exec "python -m venv --help : true"
|
||||
stub pyenv-exec "pip install virtualenv : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : true"
|
||||
@@ -134,16 +138,17 @@ OUT
|
||||
run pyenv-virtualenv --python=${TMP}/python3 venv
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.4.1 pip install virtualenv
|
||||
PYENV_VERSION=3.4.1 virtualenv --python=${TMP}/python3 ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
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
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.5.1"
|
||||
}
|
||||
|
||||
@test "install virtualenv with unsetting troublesome pip options" {
|
||||
@@ -152,25 +157,22 @@ OUT
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "pip install virtualenv : echo PIP_REQUIRE_VENV=\${PIP_REQUIRE_VENV} PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "pip install virtualenv* : echo PIP_REQUIRE_VENV=\${PIP_REQUIRE_VENV} PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "virtualenv * : echo PIP_REQUIRE_VENV=\${PIP_REQUIRE_VENV} PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
stub curl true
|
||||
|
||||
PIP_REQUIRE_VENV="true" run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PIP_REQUIRE_VENV= PYENV_VERSION=3.2.1 pip install virtualenv
|
||||
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
|
||||
Installing pip from https://bootstrap.pypa.io/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/3.2.1/envs/venv/bin/pydoc" ]
|
||||
assert_success
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
unstub curl
|
||||
teardown_version "3.2.1"
|
||||
}
|
||||
|
||||
@@ -120,7 +120,6 @@ remove_executable() {
|
||||
setup_version() {
|
||||
create_executable "$1" "python"
|
||||
remove_executable "$1" "activate"
|
||||
remove_executable "$1" "pyvenv"
|
||||
remove_executable "$1" "conda"
|
||||
}
|
||||
|
||||
@@ -131,7 +130,6 @@ teardown_version() {
|
||||
setup_virtualenv() {
|
||||
create_executable "$1" "python"
|
||||
create_executable "$1" "activate"
|
||||
remove_executable "$1" "pyvenv"
|
||||
remove_executable "$1" "conda"
|
||||
}
|
||||
|
||||
@@ -139,21 +137,19 @@ teardown_virtualenv() {
|
||||
rm -fr "${PYENV_ROOT}/versions/$1"
|
||||
}
|
||||
|
||||
setup_pyvenv() {
|
||||
setup_m_venv() {
|
||||
create_executable "$1" "python"
|
||||
create_executable "$1" "activate"
|
||||
create_executable "$1" "pyvenv"
|
||||
remove_executable "$1" "conda"
|
||||
}
|
||||
|
||||
teardown_pyvenv() {
|
||||
teardown_m_venv() {
|
||||
rm -fr "${PYENV_ROOT}/versions/$1"
|
||||
}
|
||||
|
||||
setup_conda() {
|
||||
create_executable "$1" "python"
|
||||
create_executable "$1" "activate"
|
||||
remove_executable "$1" "pyvenv"
|
||||
create_executable "$1" "conda"
|
||||
local conda="$1"
|
||||
shift 1
|
||||
@@ -161,10 +157,12 @@ setup_conda() {
|
||||
for env; do
|
||||
create_executable "${conda}/envs/${env}" "python"
|
||||
create_executable "${conda}/envs/${env}" "activate"
|
||||
remove_executable "${conda}/envs/${env}" "pyvenv"
|
||||
create_executable "${conda}/envs/${env}" "conda"
|
||||
mkdir -p "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/activate.d"
|
||||
touch "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/activate.d/activate.sh"
|
||||
mkdir -p "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/deactivate.d"
|
||||
touch "${PYENV_ROOT}/versions/${conda}/envs/${env}/etc/conda/deactivate.d/deactivate.sh"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
teardown_conda() {
|
||||
|
||||
@@ -9,28 +9,29 @@ setup() {
|
||||
@test "display virtualenv version" {
|
||||
setup_virtualenv "2.7.7"
|
||||
stub pyenv-prefix "echo '${PYENV_ROOT}/versions/2.7.7'"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv --version : echo \"1.11\""
|
||||
|
||||
run pyenv-virtualenv --version
|
||||
|
||||
assert_success
|
||||
[[ "$output" == "pyenv-virtualenv 20"*" (virtualenv 1.11)" ]]
|
||||
[[ "$output" == "pyenv-virtualenv "?.?.?" (virtualenv 1.11)" ]]
|
||||
|
||||
unstub pyenv-prefix
|
||||
unstub pyenv-exec
|
||||
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-which "pyvenv : echo \"${PYENV_ROOT}/versions/3.4.1/bin/pyvenv\""
|
||||
stub pyenv-exec "python -m venv --help : true"
|
||||
|
||||
run pyenv-virtualenv --version
|
||||
|
||||
assert_success
|
||||
[[ "$output" == "pyenv-virtualenv 20"*" (pyvenv 3.4.1)" ]]
|
||||
[[ "$output" == "pyenv-virtualenv "?.?.?" (python -m venv)" ]]
|
||||
|
||||
unstub pyenv-prefix
|
||||
teardown_pyvenv "3.4.1"
|
||||
teardown_m_venv "3.4.1"
|
||||
}
|
||||
|
||||
@@ -23,22 +23,24 @@ unstub_pyenv() {
|
||||
}
|
||||
|
||||
@test "create virtualenv from given version" {
|
||||
export PYENV_VERSION="3.2.1"
|
||||
export PYENV_VERSION="2.7.11"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
stub curl true
|
||||
|
||||
run pyenv-virtualenv "3.2.1" "venv"
|
||||
run pyenv-virtualenv "2.7.11" "venv"
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
|
||||
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
|
||||
@@ -47,10 +49,11 @@ OUT
|
||||
}
|
||||
|
||||
@test "create virtualenv from current version" {
|
||||
export PYENV_VERSION="3.2.1"
|
||||
export PYENV_VERSION="2.7.11"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-version-name "echo \${PYENV_VERSION}"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
@@ -58,12 +61,13 @@ OUT
|
||||
|
||||
run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/venv
|
||||
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
|
||||
@@ -73,10 +77,11 @@ OUT
|
||||
}
|
||||
|
||||
@test "create virtualenv with short options" {
|
||||
export PYENV_VERSION="3.2.1"
|
||||
export PYENV_VERSION="2.7.11"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-version-name "echo \${PYENV_VERSION}"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
@@ -85,10 +90,11 @@ OUT
|
||||
run pyenv-virtualenv -v -p ${TMP}/python venv
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.2.1 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/3.2.1/envs/venv
|
||||
PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${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
|
||||
@@ -99,10 +105,11 @@ OUT
|
||||
}
|
||||
|
||||
@test "create virtualenv with long options" {
|
||||
export PYENV_VERSION="3.2.1"
|
||||
export PYENV_VERSION="2.7.11"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-version-name "echo \${PYENV_VERSION}"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
@@ -111,10 +118,11 @@ OUT
|
||||
run pyenv-virtualenv --verbose --python=${TMP}/python venv
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.2.1 virtualenv --verbose --python=${TMP}/python ${PYENV_ROOT}/versions/3.2.1/envs/venv
|
||||
PYENV_VERSION=2.7.11 virtualenv --verbose --python=${TMP}/python ${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
|
||||
@@ -125,7 +133,7 @@ OUT
|
||||
}
|
||||
|
||||
@test "no whitespace allowed in virtualenv name" {
|
||||
run pyenv-virtualenv "3.2.1" "foo bar"
|
||||
run pyenv-virtualenv "2.7.11" "foo bar"
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
@@ -134,7 +142,7 @@ OUT
|
||||
}
|
||||
|
||||
@test "no tab allowed in virtualenv name" {
|
||||
run pyenv-virtualenv "3.2.1" "foo bar baz"
|
||||
run pyenv-virtualenv "2.7.11" "foo bar baz"
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
@@ -143,7 +151,7 @@ OUT
|
||||
}
|
||||
|
||||
@test "system not allowed as virtualenv name" {
|
||||
run pyenv-virtualenv "3.2.1" "system"
|
||||
run pyenv-virtualenv "2.7.11" "system"
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
@@ -152,7 +160,7 @@ OUT
|
||||
}
|
||||
|
||||
@test "no slash allowed in virtualenv name" {
|
||||
run pyenv-virtualenv "3.2.1" "foo/bar"
|
||||
run pyenv-virtualenv "2.7.11" "foo/bar"
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
@@ -161,22 +169,24 @@ OUT
|
||||
}
|
||||
|
||||
@test "slash allowed if it is the long name of the virtualenv" {
|
||||
export PYENV_VERSION="3.2.1"
|
||||
export PYENV_VERSION="2.7.11"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
|
||||
stub pyenv-exec "python -s -m ensurepip : false"
|
||||
stub pyenv-exec "python -s */get-pip.py : true"
|
||||
stub curl true
|
||||
|
||||
run pyenv-virtualenv "3.2.1" "3.2.1/envs/foo"
|
||||
run pyenv-virtualenv "2.7.11" "2.7.11/envs/foo"
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.2.1 virtualenv ${PYENV_ROOT}/versions/3.2.1/envs/foo
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user