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
|
#!/bin/bash
#
# ADT test executioner for python-* packages.
# Should be usable with any module which uses pytest-3 and packaged
# as python-MODULENAME. To use for Python3, just symlink as pytest-3
#
# Version: 1.1
#
set -efu
test_exec="$0"
test_name=$(basename "$test_exec")
test_path=$(readlink -f $0 | xargs dirname)
# which tester to use is defined by the name
tester=${test_name%%[0-9]}
# Figure out for which version of Python this test runner was intended
py_series=$(echo $test_exec | sed -e 's,.*\([0-9]\)$,\1,g')
# Construct optional PY suffix which is empty for good old python2
[ $py_series = '2' ] && PY='' || PY=$py_series
# Figure out what is the name of the module we are testing
py_module=$(sed -ne "/^Package: python${PY}/s,.*python${PY}-\(.*\),\1,gp" $test_path/../control \
| grep -v -e '-\(doc\|dbg\|lib\)' | head -n 1)
pys="$(eval py${PY}versions -rv 2>/dev/null)"
cd "${AUTOPKGTEST_TMP}"
cp -a /usr/lib/python${PY}/dist-packages/$py_module .
for py in $pys; do
echo "=== python$py ==="
python$py /usr/bin/$tester$PY ${TESTER_ARGS:-} $py_module 2>&1
done
|