Skip to content

Commit 530069a

Browse files
committed
touch up tests
1 parent 7f3c969 commit 530069a

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

tests/test_cp.sh

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,42 @@ source "$test_dir/../virtualenvwrapper_bashrc"
77

88
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
99

10-
oneTimeSetUp() {
10+
setUp () {
1111
rm -rf "$WORKON_HOME"
1212
mkdir -p "$WORKON_HOME"
13+
echo
14+
rm -f "$test_dir/catch_output"
1315
}
1416

15-
oneTimeTearDown() {
17+
tearDown() {
1618
rm -rf "$WORKON_HOME"
1719
}
1820

19-
setUp () {
20-
echo
21-
rm -f "$test_dir/catch_output"
22-
}
23-
2421

2522
test_cpvirtualenv () {
26-
mkvirtualenv "cpvirtualenvtest"
27-
$VIRTUAL_ENV/bin/easy_install "tests/testpackage"
28-
cpvirtualenv "cpvirtualenvtest" "cpvirtualenvcopy"
23+
mkvirtualenv "source"
24+
(cd tests/testpackage && python setup.py install)
25+
cpvirtualenv "source" "destination"
2926
deactivate
30-
rmvirtualenv "cpvirtualenvtest"
31-
workon "cpvirtualenvcopy"
27+
rmvirtualenv "source"
28+
workon "destination"
3229
testscript="$(which testscript.py)"
33-
assertSame "$testscript" $(echo "$WORKON_HOME/cpvirtualenvcopy/bin/testscript.py")
30+
assertTrue "Environment test script not found in path" "[ $WORKON_HOME/destination/bin/testscript.py -ef $testscript ]"
3431
testscriptcontent="$(cat $testscript)"
3532
assertTrue "No cpvirtualenvtest in $/testscriptcontent" "echo $testscriptcontent | grep cpvirtualenvtest"
3633
assertTrue virtualenvwrapper_verify_active_environment
37-
assertSame "cpvirtualenvcopy" $(basename "$VIRTUAL_ENV")
38-
cdvirtualenv
39-
assertSame "$VIRTUAL_ENV" "$(pwd)"
34+
assertSame "Wrong virtualenv name" "destination" $(basename "$VIRTUAL_ENV")
4035
}
4136

4237
test_cprelocatablevirtualenv () {
43-
mkvirtualenv "cprelocatabletest"
44-
virtualenv --relocatable "$WORKON_HOME/cprelocatabletest"
45-
cpvirtualenv "cprelocatabletest" "cprelocatablecopy"
38+
mkvirtualenv "source"
39+
(cd tests/testpackage && python setup.py install)
40+
assertTrue "virtualenv --relocatable \"$WORKON_HOME/source\""
41+
cpvirtualenv "source" "destination"
42+
testscript="$(which testscript.py)"
43+
assertTrue "Environment test script not the same as copy" "[ $WORKON_HOME/destination/bin/testscript.py -ef $testscript ]"
4644
assertTrue virtualenvwrapper_verify_active_environment
47-
assertSame "cprelocatablecopy" $(basename "$VIRTUAL_ENV")
48-
cdvirtualenv
49-
assertSame "$VIRTUAL_ENV" "$(pwd)"
45+
assertSame "Wrong virtualenv name" "destination" $(basename "$VIRTUAL_ENV")
5046
}
5147

5248
test_cp_notexists () {

0 commit comments

Comments
 (0)