Skip to content

Commit a6cd415

Browse files
committed
more test refinements
1 parent e7b0f46 commit a6cd415

13 files changed

+57
-29
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2010-05-22 Doug Hellmann <[email protected]>
2+
3+
* tests/test_cp.sh: Clarify some of the tests by breaking up,
4+
renaming, and rewriting some functions.
5+
6+
* Makefile (PYTHON26): If we're in a virtualenv when the tests
7+
start, use a hard-coded path to the binary to get the global
8+
version.
9+
110
2010-05-18 Doug Hellmann <[email protected]>
211

312
* virtualenvwrapper.sh (virtualenvwrapper_tempfile): Use a trap to

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ export VERSION=$(shell python setup.py --version)
33

44
# Locations of Python interpreter binaries
55
PYTHON27=/Users/dhellmann/Devel/virtualenvwrapper/Python/2.7b1/bin/python2.7
6+
ifeq ($VIRTUAL_ENV,)
67
PYTHON26=$(shell which python2.6)
8+
else
9+
PYTHON26=/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
10+
endif
711
PYTHON25=/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
812
PYTHON24=/Users/dhellmann/Devel/virtualenvwrapper/Python/2.4.6/bin/python2.4
913

@@ -25,7 +29,7 @@ help:
2529
@echo "installwebsite - deploy web version of docs"
2630
@echo "develop - install development version"
2731
@echo "test - run the test suite"
28-
@echo "test-quick - run the test suite for bash and one version of Python"
32+
@echo "test-quick - run the test suite for bash and one version of Python ($(PYTHON26))"
2933

3034

3135
.PHONY: sdist

tests/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"

tests/test_add2virtualenv.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"

tests/test_cd.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"

tests/test_cp.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
unset HOOK_VERBOSE_OPTION
1010

@@ -24,21 +24,26 @@ tearDown() {
2424
rm -rf "$WORKON_HOME"
2525
}
2626

27-
test_cpvirtualenv () {
27+
test_new_env_activated () {
2828
mkvirtualenv "source"
2929
(cd tests/testpackage && python setup.py install) >/dev/null 2>&1
3030
cpvirtualenv "source" "destination"
31-
assertSame "destination" $(basename "$VIRTUAL_ENV")
3231
rmvirtualenv "source"
3332
testscript="$(which testscript.py)"
3433
assertTrue "Environment test script not found in path" "[ $WORKON_HOME/destination/bin/testscript.py -ef $testscript ]"
3534
testscriptcontent="$(cat $testscript)"
36-
assertTrue "No cpvirtualenvtest in $/testscriptcontent" "echo $testscriptcontent | grep cpvirtualenvtest"
35+
assertTrue "No cpvirtualenvtest in $testscriptcontent" "echo $testscriptcontent | grep cpvirtualenvtest"
3736
assertTrue virtualenvwrapper_verify_active_environment
37+
}
38+
39+
test_virtual_env_variable () {
40+
mkvirtualenv "source"
41+
cpvirtualenv "source" "destination"
3842
assertSame "Wrong virtualenv name" "destination" $(basename "$VIRTUAL_ENV")
43+
assertTrue "$WORKON_HOME not in $VIRTUAL_ENV" "echo $VIRTUAL_ENV | grep -q $WORKON_HOME"
3944
}
4045

41-
test_cprelocatablevirtualenv () {
46+
test_source_relocatable () {
4247
mkvirtualenv "source"
4348
(cd tests/testpackage && python setup.py install) >/dev/null 2>&1
4449
assertTrue "virtualenv --relocatable \"$WORKON_HOME/source\""
@@ -49,7 +54,7 @@ test_cprelocatablevirtualenv () {
4954
assertSame "Wrong virtualenv name" "destination" $(basename "$VIRTUAL_ENV")
5055
}
5156

52-
test_cp_notexists () {
57+
test_source_does_not_exist () {
5358
out="$(cpvirtualenv virtualenvthatdoesntexist foo)"
5459
assertSame "$out" "virtualenvthatdoesntexist virtualenv doesn't exist"
5560
}

tests/test_deactivate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"

tests/test_ls.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"

tests/test_mkvirtualenv.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
6-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
5+
test_dir=$(cd $(dirname $0) && pwd)
6+
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
78

89
oneTimeSetUp() {
910
rm -rf "$WORKON_HOME"

tests/test_rmvirtualenv.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#set -x
44

5-
test_dir=$(dirname $0)
5+
test_dir=$(cd $(dirname $0) && pwd)
66

7-
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88

99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"

0 commit comments

Comments
 (0)