File: shunit2-tests.sh

package info (click to toggle)
python-virtualenv 20.17.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,580 kB
  • sloc: python: 9,952; sh: 149; ansic: 61; csh: 35; makefile: 10
file content (46 lines) | stat: -rwxr-xr-x 1,158 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Common shunit2 tests, used by all python interpreters
# Usage: shunit2-tests.sh PYTHON
# Args:
#   PYTHON: The python interpreter to run tests against

PYTHON=$1
shift

SOURCE=$(pwd)
HOME=$AUTOPKGTEST_TMP/home
mkdir -p $HOME

virtualenv -p $PYTHON $AUTOPKGTEST_TMP/ve
VP=$AUTOPKGTEST_TMP/ve/bin/python

virtualenv -p $PYTHON --system-site-packages $AUTOPKGTEST_TMP/sysve
SYSVP=$AUTOPKGTEST_TMP/sysve/bin/python

testMPipHelp() {
	$VP -m pip
	assertTrue 'Execute bare pip' $?
}

testSystemPackagesNotAvailable() {
	$VP -c 'import six'
	assertFalse 'Import system module from regular VE' $?
	$VP -m pip freeze | grep -Fq six
	assertFalse 'pip freeze lists system module from regular VE' $?
}

testSystemPackagesAvailable() {
	$SYSVP -c 'import six'
	assertTrue 'Import system module from system-site-packages VE' $?
	$SYSVP -m pip freeze | grep -Fq six
	assertTrue 'pip freeze lists system module from system-site-packages VE' $?
}

testSetuptoolsAvailable() {
	$VP -c 'import setuptools'
	assertTrue 'Import setuptools from regular VE' $?
	$SYSVP -c 'import setuptools'
	assertTrue 'Import setuptools from system-site-packages VE' $?
}

. shunit2