File: pytest

package info (click to toggle)
pydevd 3.3.0%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,892 kB
  • sloc: python: 77,508; cpp: 1,869; sh: 368; makefile: 50; ansic: 4
file content (52 lines) | stat: -rwxr-xr-x 1,447 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
47
48
49
50
51
52
#! /bin/bash

set -e

PYS=$(py3versions -s)

cp -a debian/run_tests $(cat debian/pybuild.testfiles) "$AUTOPKGTEST_TMP"
ROOTDIR=$(pwd)

cd "$AUTOPKGTEST_TMP"

# Most tests work whether or not PYTHONPATH is set to the directory containing
# the tests.  But some tests require it to be set and others fail if it is set.
# So we run pytest twice, once with and once without PYTHONPATH.

NO_PATH_TESTS=(
    tests_python/test_debugger.py::test_module_entry_point
    tests_python/test_debugger.py::test_m_switch
    tests_python/test_debugger.py::test_stop_on_start_m_switch
    tests_python/test_debugger.py::test_stop_on_start_entry_point
)

NO_PATH_DESELECTS=()
for test in "${NO_PATH_TESTS[@]}"
do
    NO_PATH_DESELECTS+=("--deselect=$test")
done


for py in $PYS
do
    echo "Testing with $py:"
    if [ -n "$(ls /usr/lib/python3/dist-packages/_pydevd_bundle/pydevd_cython.*.so 2>/dev/null)" ]
    then
	echo "Compiled Cython module found; testing it"
	export PYDEVD_USE_CYTHON=YES
    else
	echo "No compiled Cython module found"
	export PYDEVD_USE_CYTHON=NO
    fi

    # Note: we don't use "-n auto" in the pytest call, as that causes
    # weird breakages

    export PYTHONPATH=$(pwd)
    cmd="$py -m pytest ${NO_PATH_DESELECTS[*]}"
    xvfb-run -a ./run_tests $ROOTDIR/debian/get_test_exclusions $cmd
    unset PYTHONPATH

    cmd="$py -m pytest ${NO_PATH_TESTS[*]}"
    xvfb-run -a ./run_tests $ROOTDIR/debian/get_test_exclusions $cmd
done