Skip to content

Commit fd037ad

Browse files
author
Thomas Desvenain
committed
resolve conflict on tests dispatch
2 parents da4fd43 + 55a909e commit fd037ad

17 files changed

+584
-55
lines changed

.hgtags

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ c50385e9c99b207f56a968926b0f7e21a2b09366 1.22
3838
e55e8a54de7be78b8400632ab004abb29aaa8899 1.23
3939
b243d023094b6b0ef1b834dcc100f8c342c67537 1.24
4040
4a8870326d84f97d5539b586b21419ba330fea48 1.24.1
41+
f318697791416cf0897091718d542e8045854233 1.24.2
42+
06229877a640ecb490faf46f923d8be916a0ebed 1.25
43+
51eef82a39d431cee156fea7005fa1631e21655e 1.26

docsource/command_ref.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ cdsitepackages
9393

9494
Because the exact path to the site-packages directory in the virtualenv depends on the
9595
version of Python, ``cdsitepackages`` is provided as a shortcut for ``cdvirtualenv
96-
lib/python${pyvers}/site-packages``.
96+
lib/python${pyvers}/site-packages``. An optional argument is also allowed, to specify
97+
a directory hierarchy within the ``site-packages`` directory to change into.
98+
99+
::
100+
$ workon pymotw
101+
$ echo $VIRTUAL_ENV
102+
/Users/dhellmann/.virtualenvs/pymotw
103+
$ cdsitepackages PyMOTW/bisect/
104+
$ pwd
105+
/Users/dhellmann/.virtualenvs/pymotw/lib/python2.6/site-packages/PyMOTW/bisect
97106

98107
===============
99108
Path Management

docsource/history.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ Release History
44

55
- Added cpvirtualenv command [Thomas Desvenain]
66

7+
1.26
8+
9+
- Fix a problem with error messages showing up during init for users
10+
with the wrappers installed site-wide but who are not actually
11+
using them. See issue #26.
12+
- Split up the tests into multiple files.
13+
- Run all tests with all supported shells.
14+
15+
1.25
16+
17+
- Merged in changes to cdsitepackages from William McVey. It now
18+
takes an argument and supports tab-completion for directories
19+
within site-packages.
20+
21+
1.24.2
22+
23+
- Add user provided :ref:`tips-and-tricks` section.
24+
- Add link to Rich Leland's screencast to :ref:`references` section.
25+
26+
1.24.1
27+
28+
- Add license text to the header of the script.
29+
730
1.24
831

932
- Resolve a bug with the preactivate hook not being run properly.

docsource/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Details
5757
history
5858
developers
5959

60+
.. _references:
61+
6062
==========
6163
References
6264
==========

docsource/tips.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _tips-and-tricks:
2+
13
=================
24
Tips and Tricks
35
=================

pavement.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# What project are we building?
2929
PROJECT = 'virtualenvwrapper'
30-
VERSION = '1.24.1'
30+
VERSION = '1.26'
3131
os.environ['VERSION'] = VERSION
3232

3333
# Read the long description to give to setup
@@ -192,7 +192,14 @@ def test_install(options):
192192

193193
@task
194194
def test():
195-
sh('bash ./tests/test.sh')
196-
sh('SHUNIT_PARENT=./tests/test.sh zsh -o shwordsplit ./tests/test.sh')
197-
sh('bash ./tests/test_misconfigured.sh')
195+
#test_scripts = glob.glob('./tests/test*.sh')
196+
test_scripts = path('tests').glob('test*.sh')
197+
print test_scripts
198+
for shell_cmd in [ 'bash', 'sh', 'SHUNIT_PARENT=%(test_script)s zsh -o shwordsplit' ]:
199+
for test_script in test_scripts:
200+
base_cmd = shell_cmd + ' %(test_script)s'
201+
cmd = base_cmd % locals()
202+
print '*' * 80
203+
print
204+
sh(cmd)
198205
return
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version="$2"
99

1010
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
1111
mkvirtualenv "installtest"
12-
easy_install "$dist_dir/virtualenvwrapper-$version.tar.gz"
12+
pip install "$dist_dir/virtualenvwrapper-$version.tar.gz"
1313
RC=$?
1414

1515
rm -rf "$WORKON_HOME"

tests/test_add2virtualenv.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
3+
#set -x
4+
5+
test_dir=$(dirname $0)
6+
source "$test_dir/../virtualenvwrapper_bashrc"
7+
8+
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
9+
10+
oneTimeSetUp() {
11+
rm -rf "$WORKON_HOME"
12+
mkdir -p "$WORKON_HOME"
13+
}
14+
15+
oneTimeTearDown() {
16+
rm -rf "$WORKON_HOME"
17+
}
18+
19+
setUp () {
20+
echo
21+
rm -f "$test_dir/catch_output"
22+
}
23+
24+
test_add2virtualenv () {
25+
mkvirtualenv "pathtest"
26+
add2virtualenv "/full/path"
27+
cdsitepackages
28+
path_file="./virtualenv_path_extensions.pth"
29+
assertTrue "No /full/path in `cat $path_file`" "grep /full/path $path_file"
30+
cd -
31+
}
32+
33+
test_add2virtualenv_relative () {
34+
mkvirtualenv "pathtest"
35+
parent_dir=$(dirname $(pwd))
36+
base_dir=$(basename $(pwd))
37+
add2virtualenv "../$base_dir"
38+
cdsitepackages
39+
path_file="./virtualenv_path_extensions.pth"
40+
assertTrue "No $parent_dir/$base_dir in \"`cat $path_file`\"" "grep \"$parent_dir/$base_dir\" $path_file"
41+
cd - >/dev/null 2>&1
42+
}
43+
44+
45+
. "$test_dir/shunit2"

tests/test_cd.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
3+
#set -x
4+
5+
test_dir=$(dirname $0)
6+
source "$test_dir/../virtualenvwrapper_bashrc"
7+
8+
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
9+
10+
oneTimeSetUp() {
11+
rm -rf "$WORKON_HOME"
12+
mkdir -p "$WORKON_HOME"
13+
}
14+
15+
oneTimeTearDown() {
16+
rm -rf "$WORKON_HOME"
17+
}
18+
19+
setUp () {
20+
echo
21+
rm -f "$test_dir/catch_output"
22+
}
23+
24+
test_cdvirtual() {
25+
pushd "$(pwd)" >/dev/null
26+
cdvirtualenv
27+
assertSame "$VIRTUAL_ENV" "$(pwd)"
28+
cdvirtualenv bin
29+
assertSame "$VIRTUAL_ENV/bin" "$(pwd)"
30+
popd >/dev/null
31+
}
32+
33+
test_cdsitepackages () {
34+
pushd "$(pwd)" >/dev/null
35+
cdsitepackages
36+
pyvers=$(python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
37+
sitepackages="$VIRTUAL_ENV/lib/python${pyvers}/site-packages"
38+
assertSame "$sitepackages" "$(pwd)"
39+
popd >/dev/null
40+
}
41+
42+
test_cdsitepackages_with_arg () {
43+
pushd "$(pwd)" >/dev/null
44+
pyvers=$(python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
45+
sitepackage_subdir="$VIRTUAL_ENV/lib/python${pyvers}/site-packages/subdir"
46+
mkdir -p "${sitepackage_subdir}"
47+
cdsitepackages subdir
48+
assertSame "$sitepackage_subdir" "$(pwd)"
49+
popd >/dev/null
50+
}
51+
52+
test_cdvirtualenv_no_workon_home () {
53+
old_home="$WORKON_HOME"
54+
export WORKON_HOME="$WORKON_HOME/not_there"
55+
output=`cdvirtualenv 2>&1`
56+
assertTrue "Did not see expected message" "echo $output | grep 'does not exist'"
57+
WORKON_HOME="$old_home"
58+
}
59+
60+
test_cdsitepackages_no_workon_home () {
61+
old_home="$WORKON_HOME"
62+
export WORKON_HOME="$WORKON_HOME/not_there"
63+
output=`cdsitepackages 2>&1`
64+
assertTrue "Did not see expected message" "echo $output | grep 'does not exist'"
65+
WORKON_HOME="$old_home"
66+
}
67+
68+
69+
. "$test_dir/shunit2"

tests/test_cp.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
3+
#set -x
4+
5+
test_dir=$(dirname $0)
6+
source "$test_dir/../virtualenvwrapper_bashrc"
7+
8+
export WORKON_HOME="${TMPDIR:-/tmp}/WORKON_HOME"
9+
10+
oneTimeSetUp() {
11+
rm -rf "$WORKON_HOME"
12+
mkdir -p "$WORKON_HOME"
13+
}
14+
15+
oneTimeTearDown() {
16+
rm -rf "$WORKON_HOME"
17+
}
18+
19+
setUp () {
20+
echo
21+
rm -f "$test_dir/catch_output"
22+
}
23+
24+
25+
test_cpvirtualenv () {
26+
mkvirtualenv "cpvirtualenvtest"
27+
$VIRTUAL_ENV/bin/easy_install "tests/testpackage"
28+
cpvirtualenv "cpvirtualenvtest" "cpvirtualenvcopy"
29+
deactivate
30+
rmvirtualenv "cpvirtualenvtest"
31+
workon "cpvirtualenvcopy"
32+
testscript="$(which testscript.py)"
33+
assertSame "$testscript" $(echo "$WORKON_HOME/cpvirtualenvcopy/bin/testscript.py")
34+
testscriptcontent="$(cat $testscript)"
35+
assertTrue "No cpvirtualenvtest in $/testscriptcontent" "echo $testscriptcontent | grep cpvirtualenvtest"
36+
assertTrue virtualenvwrapper_verify_active_environment
37+
assertSame "cpvirtualenvcopy" $(basename "$VIRTUAL_ENV")
38+
cdvirtualenv
39+
assertSame "$VIRTUAL_ENV" "$(pwd)"
40+
}
41+
42+
test_cprelocatablevirtualenv () {
43+
mkvirtualenv "cprelocatabletest"
44+
virtualenv --relocatable "$WORKON_HOME/cprelocatabletest"
45+
cpvirtualenv "cprelocatabletest" "cprelocatablecopy"
46+
assertTrue virtualenvwrapper_verify_active_environment
47+
assertSame "cprelocatablecopy" $(basename "$VIRTUAL_ENV")
48+
cdvirtualenv
49+
assertSame "$VIRTUAL_ENV" "$(pwd)"
50+
}
51+
52+
53+
. "$test_dir/shunit2"
54+

0 commit comments

Comments
 (0)