-
-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance and output of pyenv virtualenvs
#502
base: master
Are you sure you want to change the base?
Changes from all commits
ae6373c
f442d7f
76a18ae
30a15a5
db5d69d
ee98390
04cd302
a075b3c
10a9658
b459977
61c1b45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,15 @@ load test_helper | |
|
||
setup() { | ||
export PYENV_ROOT="${TMP}/pyenv" | ||
mkdir -p "${PYENV_ROOT}/versions/2.7.6" | ||
mkdir -p "${PYENV_ROOT}/versions/3.3.3" | ||
mkdir -p "${PYENV_ROOT}/versions/venv27" | ||
mkdir -p "${PYENV_ROOT}/versions/venv33" | ||
mkdir -p "${PYENV_ROOT}/versions/2.7.6/envs/venv27" | ||
mkdir -p "${PYENV_ROOT}/versions/3.3.3/envs/venv33" | ||
ln -s "venv27" "${PYENV_ROOT}/versions/venv27" | ||
ln -s "venv33" "${PYENV_ROOT}/versions/venv33" | ||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAICS the links are created in the current directory. That doesn't seem correct. |
||
} | ||
|
||
create_alias() { | ||
mkdir -p "${PYENV_ROOT}/versions" | ||
ln -s "$2" "${PYENV_ROOT}/versions/$1" | ||
} | ||
|
||
@test "list virtual environments only" { | ||
|
@@ -21,40 +26,40 @@ setup() { | |
|
||
assert_success | ||
assert_output <<OUT | ||
venv27 (created from ${PYENV_ROOT}/versions/2.7.6) | ||
venv33 (created from ${PYENV_ROOT}/versions/3.3.3) | ||
2.7.6/envs/venv27 | ||
3.3.3/envs/venv33 | ||
OUT | ||
|
||
unstub pyenv-version-name | ||
unstub pyenv-virtualenv-prefix | ||
# unstub pyenv-version-name | ||
# unstub pyenv-virtualenv-prefix | ||
} | ||
|
||
@test "list virtual environments with hit prefix" { | ||
stub pyenv-version-name ": echo venv33" | ||
stub pyenv-virtualenv-prefix "2.7.6 : false" | ||
stub pyenv-virtualenv-prefix "3.3.3 : false" | ||
stub pyenv-virtualenv-prefix "venv27 : echo \"/usr\"" | ||
stub pyenv-virtualenv-prefix "venv33 : echo \"/usr\"" | ||
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/2.7.6\"" | ||
stub pyenv-virtualenv-prefix "venv33 : echo \"${PYENV_ROOT}/versions/3.3.3\"" | ||
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this change improves anything. As a rule of thumb, one should not change test cases unless you've changed the behavior in them -- to avoid accidentally losing test cover. |
||
|
||
run pyenv-virtualenvs | ||
|
||
assert_success | ||
assert_output <<OUT | ||
venv27 (created from /usr) | ||
* venv33 (created from /usr) | ||
2.7.6/envs/venv27 | ||
* 3.3.3/envs/venv33 | ||
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diagnosed this failure. The logic does not equate " To diagnose stuff in tests, I set PS4 to the long value from the launcher and run the command with PYENV_DEBUG=1. Then make sure there's a command later that prints its output in some form (in this case, |
||
OUT | ||
|
||
unstub pyenv-version-name | ||
unstub pyenv-virtualenv-prefix | ||
# unstub pyenv-version-name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
# unstub pyenv-virtualenv-prefix | ||
} | ||
|
||
@test "list virtual environments with --bare" { | ||
stub pyenv-virtualenv-prefix "2.7.6 : false" | ||
stub pyenv-virtualenv-prefix "3.3.3 : false" | ||
stub pyenv-virtualenv-prefix "venv27 : echo \"/usr\"" | ||
stub pyenv-virtualenv-prefix "venv33 : echo \"/usr\"" | ||
stub pyenv-virtualenv-prefix "venv27 : echo \"${PYENV_ROOT}/versions/2.7.6\"" | ||
stub pyenv-virtualenv-prefix "venv33 : echo \"${PYENV_ROOT}/versions/3.3.3\"" | ||
|
||
run pyenv-virtualenvs --bare | ||
run pyenv-virtualenvs --bare --only-aliases | ||
|
||
assert_success | ||
assert_output <<OUT | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a design change -- so this should be discussed separately. Envs are supposed to be accessible under both full name and alias. I'm not sure why that is; aliases are internally called "compat", indicating that they were added for compatibility with... something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove that change for now and we can discuss elsewhere. What's the best place to have a design discussion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussions.