File tree Expand file tree Collapse file tree 4 files changed +46
-1
lines changed
Expand file tree Collapse file tree 4 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ 2010-12-26 Doug Hellmann <dhellmann@racemi.com>
2+
3+ * virtualenvwrapper.sh (virtualenvwrapper_get_python_version): Use
4+ python's -V option and cut to get the version instead of a python
5+ one-liner.
6+
172010-12-24 Doug Hellmann <dhellmann@racemi.com>
28
39 * virtualenvwrapper.sh (cpvirtualenv): Ensure that both pre hooks
Original file line number Diff line number Diff line change @@ -44,5 +44,10 @@ test_no_workon_home () {
4444 WORKON_HOME=" $old_home "
4545}
4646
47+ test_get_site_packages_dir () {
48+ d=$( virtualenvwrapper_get_site_packages_dir)
49+ assertTrue " [ -d $d ]"
50+ }
51+
4752
4853. " $test_dir /shunit2"
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # set -x
4+
5+ test_dir=$( cd $( dirname $0 ) && pwd)
6+
7+ export WORKON_HOME=" $( echo ${TMPDIR:-/ tmp} /WORKON_HOME | sed ' s|//|/|g' ) "
8+
9+ oneTimeSetUp () {
10+ rm -rf " $WORKON_HOME "
11+ mkdir -p " $WORKON_HOME "
12+ source " $test_dir /../virtualenvwrapper.sh"
13+ mkvirtualenv testing
14+ }
15+
16+ oneTimeTearDown () {
17+ rm -rf " $WORKON_HOME "
18+ }
19+
20+ setUp () {
21+ echo
22+ rm -f " $test_dir /catch_output"
23+ }
24+
25+ test_get_python_version () {
26+ expected=" $( $VIRTUAL_ENV /bin/python -V 2>&1 | cut -f2 -d' ' ) "
27+ echo " Expecting: $expected "
28+ vers=$( virtualenvwrapper_get_python_version)
29+ echo " Got : $vers "
30+ assertSame " $expected " " $vers "
31+ }
32+
33+
34+ . " $test_dir /shunit2"
Original file line number Diff line number Diff line change @@ -407,7 +407,7 @@ virtualenvwrapper_get_python_version () {
407407 # Uses the Python from the virtualenv because we're trying to
408408 # determine the version installed there so we can build
409409 # up the path to the site-packages directory.
410- python -c ' import sys; print ".".join(str(p) for p in sys.version_info[:2]) '
410+ python -V 2>&1 | cut -f2 -d ' '
411411}
412412
413413# Prints the path to the site-packages directory for the current environment.
You can’t perform that action at this time.
0 commit comments