Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: bootstrap/virtualenv/tests/test_activate.sh

Issue 2043213002: Roll virtualenv 12.0->15.0.2 (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: vendor virtualenv and exclude from gender check Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/sh
2
3 set -u
4
5 ROOT="$(dirname $0)/.."
6 VIRTUALENV="${ROOT}/virtualenv.py"
7 TESTENV="/tmp/test_virtualenv_activate.venv"
8
9 rm -rf ${TESTENV}
10
11 echo "$0: Creating virtualenv ${TESTENV}..." 1>&2
12
13 ${VIRTUALENV} ${TESTENV} | tee ${ROOT}/tests/test_activate_output.actual
14 if ! diff ${ROOT}/tests/test_activate_output.expected ${ROOT}/tests/test_activat e_output.actual; then
15 echo "$0: Failed to get expected output from ${VIRTUALENV}!" 1>&2
16 exit 1
17 fi
18
19 echo "$0: Created virtualenv ${TESTENV}." 1>&2
20
21 echo "$0: Activating ${TESTENV}..." 1>&2
22 . ${TESTENV}/bin/activate
23 echo "$0: Activated ${TESTENV}." 1>&2
24
25 echo "$0: Checking value of \$VIRTUAL_ENV..." 1>&2
26
27 if [ "$VIRTUAL_ENV" != "${TESTENV}" ]; then
28 echo "$0: Expected \$VIRTUAL_ENV to be set to \"${TESTENV}\"; actual value: \"${VIRTUAL_ENV}\"!" 1>&2
29 exit 2
30 fi
31
32 echo "$0: \$VIRTUAL_ENV = \"${VIRTUAL_ENV}\" -- OK." 1>&2
33
34 echo "$0: Checking output of \$(which python)..." 1>&2
35
36 if [ "$(which python)" != "${TESTENV}/bin/python" ]; then
37 echo "$0: Expected \$(which python) to return \"${TESTENV}/bin/python\"; act ual value: \"$(which python)\"!" 1>&2
38 exit 3
39 fi
40
41 echo "$0: Output of \$(which python) is OK." 1>&2
42
43 echo "$0: Checking output of \$(which pip)..." 1>&2
44
45 if [ "$(which pip)" != "${TESTENV}/bin/pip" ]; then
46 echo "$0: Expected \$(which pip) to return \"${TESTENV}/bin/pip\"; actual va lue: \"$(which pip)\"!" 1>&2
47 exit 4
48 fi
49
50 echo "$0: Output of \$(which pip) is OK." 1>&2
51
52 echo "$0: Checking output of \$(which easy_install)..." 1>&2
53
54 if [ "$(which easy_install)" != "${TESTENV}/bin/easy_install" ]; then
55 echo "$0: Expected \$(which easy_install) to return \"${TESTENV}/bin/easy_in stall\"; actual value: \"$(which easy_install)\"!" 1>&2
56 exit 5
57 fi
58
59 echo "$0: Output of \$(which easy_install) is OK." 1>&2
60
61 echo "$0: Executing a simple Python program..." 1>&2
62
63 TESTENV=${TESTENV} python <<__END__
64 import os, sys
65
66 expected_site_packages = os.path.join(os.environ['TESTENV'], 'lib','python%s' % sys.version[:3], 'site-packages')
67 site_packages = os.path.join(os.environ['VIRTUAL_ENV'], 'lib', 'python%s' % sys. version[:3], 'site-packages')
68
69 assert site_packages == expected_site_packages, 'site_packages did not have expe cted value; actual value: %r' % site_packages
70
71 open(os.path.join(site_packages, 'pydoc_test.py'), 'w').write('"""This is pydoc_ test.py"""\n')
72 __END__
73
74 if [ $? -ne 0 ]; then
75 echo "$0: Python script failed!" 1>&2
76 exit 6
77 fi
78
79 echo "$0: Execution of a simple Python program -- OK." 1>&2
80
81 echo "$0: Testing pydoc..." 1>&2
82
83 if ! PAGER=cat pydoc pydoc_test | grep 'This is pydoc_test.py' > /dev/null; then
84 echo "$0: pydoc test failed!" 1>&2
85 exit 7
86 fi
87
88 echo "$0: pydoc is OK." 1>&2
89
90 echo "$0: Deactivating ${TESTENV}..." 1>&2
91 deactivate
92 echo "$0: Deactivated ${TESTENV}." 1>&2
93 echo "$0: OK!" 1>&2
94
95 rm -rf ${TESTENV}
96
OLDNEW
« no previous file with comments | « bootstrap/virtualenv/tests/__init__.py ('k') | bootstrap/virtualenv/tests/test_activate_output.expected » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698