Debian Codegraph @

debian/tests/module-install-venv

raw
1 #!/bin/sh
2
3 cp -a debian/tests/packages "$AUTOPKGTEST_TMP"
4 HOME="$AUTOPKGTEST_TMP/home"
5 mkdir -p "$HOME"
6 python3.14 -m venv "$AUTOPKGTEST_TMP/ve"
7
8 site_packages="$AUTOPKGTEST_TMP/ve/lib/python3.14/site-packages"
9 VP="$AUTOPKGTEST_TMP/ve/bin/python"
10
11 tearDown() {
12 # Remove any fibpy/fibc installed in the venv
13 $VP -m pip uninstall --yes fibpy fibc setuptools
14 rm -f $site_packages/fibpy.egg-link
15 }
16
17 testVirtualenvLayout() {
18 assertTrue 'pip command installed' "[ -f $AUTOPKGTEST_TMP/ve/bin/pip ]"
19 assertTrue 'pip library installed' "[ -d $site_packages/pip ]"
20 }
21
22 testFibPy() {
23 cd "$AUTOPKGTEST_TMP/packages/fibpy"
24 $VP -m pip install --no-index -f /usr/share/python-wheels/ setuptools
25 $VP setup.py install
26 assertTrue 'Install fibpy in a virtualenv' $?
27 assertTrue 'fibpy was installed to virtualenv' "[ -e $site_packages/fibpy-*.egg ]"
28 cd "$AUTOPKGTEST_TMP"
29 stdout=$($VP -m fibpy 5)
30 assertTrue 'Execute fibpy from a virtualenv' $?
31 assertEquals 'Correct result' 8 "$stdout"
32 }
33
34 testFibC() {
35 cd "$AUTOPKGTEST_TMP/packages/fibc"
36 $VP -m pip install --no-index -f /usr/share/python-wheels/ setuptools
37 $VP setup.py install
38 assertTrue 'Install fibc in a virtualenv' $?
39 assertTrue 'fibc was installed to virtualenv' "[ -e $site_packages/fibc-*.egg ]"
40 cd "$AUTOPKGTEST_TMP"
41 stdout=$($VP -c 'from fibc import fib; print(fib(5))')
42 assertTrue 'Execute fibc from a virtualenv' $?
43 assertEquals 'Correct result' 8 "$stdout"
44 }
45
46 testFibPyDevelop() {
47 cd "$AUTOPKGTEST_TMP/packages/fibpy"
48 $VP -m pip install --no-index -f /usr/share/python-wheels/ setuptools
49 $VP setup.py develop
50 assertTrue 'Install editable fibpy in a virtualenv' $?
51 assertTrue 'fibpy was linked to virtualenv' "[ -e $site_packages/fibpy.egg-link ]"
52 cd "$AUTOPKGTEST_TMP"
53 stdout=$($VP -m fibpy 5)
54 assertTrue 'Execute editable fibpy from a virtualenv' $?
55 assertEquals 'Correct result' 8 "$stdout"
56 }
57
58 testFibPyPip() {
59 cd "$AUTOPKGTEST_TMP"
60 $VP -m pip install --no-index -f /usr/share/python-wheels/ \
61 -v "$AUTOPKGTEST_TMP/packages/fibpy"
62 assertTrue 'Install fibpy via pip in a virtualenv' $?
63 assertTrue 'fibpy was installed to virtualenv' "[ -e $site_packages/fibpy.py ]"
64 stdout=$($VP -m fibpy 5)
65 assertTrue 'Execute fibpy from virtualenv' $?
66 assertEquals 'Correct result' 8 "$stdout"
67 }
68
69 testFibPyPipEditable() {
70 cd "$AUTOPKGTEST_TMP"
71 $VP -m pip install --no-index -f /usr/share/python-wheels/ \
72 -v -e "$AUTOPKGTEST_TMP/packages/fibpy"
73 assertTrue 'Install editable fibpy via pip in a virtualenv' $?
74 assertTrue 'fibpy was linked to virtualenv' "[ -e $site_packages/__editable__.fibpy-42.0.0.pth ]"
75 stdout=$($VP -m fibpy 5)
76 assertTrue 'Execute fibpy from virtualenv' $?
77 assertEquals 'Correct result' 8 "$stdout"
78 }
79
80 . shunit2