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

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

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

Powered by Google App Engine
This is Rietveld 408576698