Skip to content

Commit 0b1d952

Browse files
committed
changes to make the tests run on my linux host
1 parent 5105cef commit 0b1d952

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
2010-05-16 Doug Hellmann <[email protected]>
22

3+
* Makefile (PYTHON26): Use which to find python2.6, the default
4+
interpreter, so we can run the tests as "make test-quick" on other
5+
hosts.
6+
7+
* tests/test_tempfile.sh (test_tempfile): Normalize the paths so
8+
we don't depend on the value of TMPDIR or behavior of dirname.
9+
10+
* tests/test_cd.sh: Make sure the virtualenv from the caller does
11+
not influence test behaviors by establishing our own virtualenv
12+
locally.
13+
314
* virtualenvwrapper/hook_loader.py (main): Add more debug logging
415
to try to narrow down the tempfile issue (#35).
16+
(run_hooks): Insert a comment into the output file to show which
17+
hook we are running.
518

619
* virtualenvwrapper.sh (virtualenvwrapper_run_hook): Add more
720
debugging error reporting to try to narrow down the tempfile

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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-
PYTHON26=/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
6+
PYTHON26=$(shell which python2.6)
77
PYTHON25=/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
88
PYTHON24=/Users/dhellmann/Devel/virtualenvwrapper/Python/2.4.6/bin/python2.4
99

@@ -95,7 +95,7 @@ test-loop:
9595
echo '********************************************************************************' ; \
9696
echo "Running $$test_script with $(TEST_SHELL) under Python $(basename $$py_bin)" ; \
9797
echo ; \
98-
VIRTUALENVWRAPPER_PYTHON=$$TMPDIR/virtualenvwrapper-test-env/bin/python SHUNIT_PARENT=$$test_script $(TEST_SHELL) $$test_script || exit 1 ; \
98+
HOOK_VERBOSE_OPTION=-v VIRTUALENVWRAPPER_PYTHON=$$TMPDIR/virtualenvwrapper-test-env/bin/python SHUNIT_PARENT=$$test_script $(TEST_SHELL) $$test_script || exit 1 ; \
9999
echo ; \
100100
done \
101101
done

tests/test_cd.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
99
oneTimeSetUp() {
1010
rm -rf "$WORKON_HOME"
1111
mkdir -p "$WORKON_HOME"
12+
unset VIRTUAL_ENV
1213
source "$test_dir/../virtualenvwrapper.sh"
14+
mkvirtualenv cd-test
15+
deactivate
1316
}
1417

1518
oneTimeTearDown() {
@@ -19,6 +22,11 @@ oneTimeTearDown() {
1922
setUp () {
2023
echo
2124
rm -f "$test_dir/catch_output"
25+
workon cd-test
26+
}
27+
28+
tearDown () {
29+
deactivate
2230
}
2331

2432
test_cdvirtual() {

tests/test_tempfile.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ setUp () {
2525

2626
test_tempfile () {
2727
filename=$(virtualenvwrapper_tempfile hook)
28+
assertTrue "Filename is empty" "[ ! -z \"$filename\" ]"
2829
rm -f $filename
29-
assertSame "TMPDIR and path not the same for $filename." "$TMPDIR" "$(dirname $filename)/"
30+
comparable_tmpdir=$(echo $TMPDIR | sed 's|/$||')
31+
comparable_dirname=$(dirname $filename | sed 's|/$||')
32+
assertSame "TMPDIR and path not the same for $filename" "$comparable_tmpdir" "$comparable_dirname"
3033
assertTrue "virtualenvwrapper-hook not in filename." "echo $filename | grep virtualenvwrapper-hook"
3134
}
3235

virtualenvwrapper/hook_loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def run_hooks(hook, options, args, output=None):
132132
# be run in the calling shell.
133133
contents = (plugin(args[1:]) or '').strip()
134134
if contents:
135+
output.write('# %s\n' % ep.name)
135136
output.write(contents)
136137
output.write("\n")
137138
else:

0 commit comments

Comments
 (0)