mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Reject creating a virtualenv named system (yyuu/pyenv#475)
This commit is contained in:
@@ -273,6 +273,11 @@ if [ -z "${VERSION_NAME}" ] || [ -z "${VIRTUALENV_NAME}" ]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [[ "$VIRTUALENV_NAME" == "system" ]]; then
|
||||
echo "pyenv-virtualenv: \`system' is not allowed as virtualenv name." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$VIRTUALENV_NAME" != "${VIRTUALENV_NAME%[[:space:]]*}" ]; then
|
||||
echo "pyenv-virtualenv: no whitespace allowed in virtualenv name." 1>&2
|
||||
exit 1
|
||||
|
||||
@@ -135,3 +135,12 @@ OUT
|
||||
pyenv-virtualenv: no whitespace allowed in virtualenv name.
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "system not allowed as virtualenv name" {
|
||||
run pyenv-virtualenv "3.2.1" "system"
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
pyenv-virtualenv: \`system' is not allowed as virtualenv name.
|
||||
OUT
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user