#!/bin/sh
set -efu

export PYTHONWARNINGS=d
# Use patched hypercorn; see https://github.com/urllib3/urllib3/issues/3334
export PYTHONPATH=$(pwd)/debian/vendor
# Use longer timeouts, see https://github.com/urllib3/urllib3/issues/3164
export CI=1

python3_all="$(py3versions -s 2>/dev/null)"

cp -r dummyserver test "$AUTOPKGTEST_TMP/"
cd "$AUTOPKGTEST_TMP"

for py in $python3_all; do
    echo "=== $py ==="
    $py -m pytest --verbose -m 'not requires_network' \
        --deselect test/test_connection.py::TestConnection::test_recent_date \
        --deselect test/test_response.py::TestResponse::test_chunked_decoding_gzip_swallow_garbage \
        --deselect 'test/test_response.py::TestResponse::test_read_chunked_with_trailing_data_does_not_hang[gzip]'
done
