Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/README.pytest
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ runtests.sh build the venv on first run (it invokes `uv sync` for you);
or create it yourself, from test/:
> uv sync

'aioquic', which some HTTP/3 tests use, is especially difficult to
build on some platforms, such as AIX. Set PYHTTPD_NO_AIOQUIC=1 and
runtests.sh leaves it out of the venv, or run
`uv sync --no-group aioquic` yourself; those tests then skip. To drop
it from a venv already built, remove test/.venv first.

Where 'cryptography' is especially difficult to build (it needs Rust)
but the OS ships it, as the AIX Toolbox does, name the packages to take
from the system python in PYHTTPD_SYSTEM_PACKAGES, and that python in
PYHTTPD_PYTHON if it is not 'python3' on PATH. runtests.sh then builds
the venv on that python with its site-packages visible and installs
the rest:
> PYHTTPD_SYSTEM_PACKAGES="cryptography cffi pycparser pyopenssl" \
PYHTTPD_NO_AIOQUIC=1 ./runtests.sh ...
The system python must be 3.11 or later. Remove test/.venv first to
rebuild one made without these.

And for 'h2load':
> apt install nghttp2-client

Expand Down
32 changes: 23 additions & 9 deletions test/modules/http3/test_016_cid_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,31 @@

import pytest

from aioquic.buffer import Buffer
from aioquic.h3.connection import H3_ALPN
from aioquic.quic import events as quic_events
from aioquic.quic.configuration import QuicConfiguration
from aioquic.quic.connection import QuicConnection
from aioquic.quic.packet import pull_quic_transport_parameters

from .env import H3Conf

pytestmark = pytest.mark.skipif(not sys.platform.startswith("linux"),
reason="SO_REUSEPORT buckets are Linux only")
from pyhttpd.depends import needs_dependency

# The tests skip without aioquic (it is especially difficult to build on
# some platforms, such as AIX), so the import must not fail collection;
# the fallback base classes only let the module load.
try:
from aioquic.buffer import Buffer
from aioquic.h3.connection import H3_ALPN
from aioquic.quic import events as quic_events
from aioquic.quic.configuration import QuicConfiguration
from aioquic.quic.connection import QuicConnection
from aioquic.quic.packet import pull_quic_transport_parameters
HAVE_AIOQUIC = True
except ImportError:
HAVE_AIOQUIC = False
QuicConnection = object

pytestmark = [
pytest.mark.skipif(not sys.platform.startswith("linux"),
reason="SO_REUSEPORT buckets are Linux only"),
needs_dependency("aioquic", HAVE_AIOQUIC,
reason="python package 'aioquic' is not installed"),
]


class _Conn(QuicConnection):
Expand Down
25 changes: 19 additions & 6 deletions test/modules/http3/test_203_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,25 @@

from .env import H3Conf

from aioquic.asyncio.client import connect
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.buffer import encode_uint_var
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import DataReceived, HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
from pyhttpd.depends import needs_dependency

# The tests skip without aioquic (it is especially difficult to build on
# some platforms, such as AIX), so the import must not fail collection;
# the fallback base classes only let the module load.
try:
from aioquic.asyncio.client import connect
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.buffer import encode_uint_var
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import DataReceived, HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
HAVE_AIOQUIC = True
except ImportError:
HAVE_AIOQUIC = False
QuicConnectionProtocol = object

pytestmark = needs_dependency("aioquic", HAVE_AIOQUIC,
reason="python package 'aioquic' is not installed")

FRAME_TYPE_PRIORITY_UPDATE_REQUEST_STREAM = 0xF0700

Expand Down
23 changes: 18 additions & 5 deletions test/modules/http3/test_204_multiplexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@

from .env import H3Conf

from aioquic.asyncio.client import connect
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import DataReceived, HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
from pyhttpd.depends import needs_dependency

# The tests skip without aioquic (it is especially difficult to build on
# some platforms, such as AIX), so the import must not fail collection;
# the fallback base classes only let the module load.
try:
from aioquic.asyncio.client import connect
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import DataReceived, HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
HAVE_AIOQUIC = True
except ImportError:
HAVE_AIOQUIC = False
QuicConnectionProtocol = object

pytestmark = needs_dependency("aioquic", HAVE_AIOQUIC,
reason="python package 'aioquic' is not installed")

N_CONCURRENT_GETS = 20
POST_BODY_LEN = 100_000
Expand Down
25 changes: 19 additions & 6 deletions test/modules/http3/test_205_qpack_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@
import asyncio
import itertools

import pylsqpack
import pytest

from .env import H3Conf

from aioquic.asyncio.client import connect
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
from pyhttpd.depends import needs_dependency

# The tests skip without aioquic (it is especially difficult to build on
# some platforms, such as AIX), so the import must not fail collection;
# the fallback base classes only let the module load.
try:
import pylsqpack
from aioquic.asyncio.client import connect
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
HAVE_AIOQUIC = True
except ImportError:
HAVE_AIOQUIC = False
QuicConnectionProtocol = H3Connection = object

pytestmark = needs_dependency("aioquic", HAVE_AIOQUIC,
reason="python package 'aioquic' is not installed")

BATCH = 20
N_REQUESTS = 3000
Expand Down
9 changes: 8 additions & 1 deletion test/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ dependencies = [
"pyopenssl",
"packaging",
"websockets",
"aioquic",
]

[dependency-groups]
# The HTTP/3 client of some mod_http3 tests, which skip without it. Its
# dependencies are especially difficult to build on some platforms (AIX):
# runtests.sh leaves it out when PYHTTPD_NO_AIOQUIC is set, as does
# `uv sync --no-group aioquic`.
aioquic = ["aioquic"]

[tool.uv]
package = false
default-groups = ["aioquic"]

[tool.pytest.ini_options]
python_files = ["test_*.py", "*_test.py"]
Expand Down
31 changes: 29 additions & 2 deletions test/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
# on PATH)
# HTTPD path to httpd (when there is no apxs)
# PHP_FPM path to php-fpm (default: first php-fpm on PATH; PHP tests skip if none)
# PYHTTPD_NO_AIOQUIC if set, the venv is built without the 'aioquic'
# package, and the HTTP/3 tests which need it skip
# PYHTTPD_SYSTEM_PACKAGES space-separated python packages to use from the
# system python instead of installing them into the venv, e.g.
# "cryptography cffi pycparser pyopenssl" on AIX
# PYHTTPD_PYTHON the system python those come from (default: python3)
#
set -eu

Expand All @@ -50,8 +56,29 @@ if [ ! -x "$PYTEST" ] || [ "$here/pyproject.toml" -nt "$here/.venv" ] \
echo " Install it from https://docs.astral.sh/uv/ and re-run." >&2
exit 1
fi
echo "runtests.sh: (re)creating $here/.venv via 'uv sync'..." >&2
uv sync --project "$here"
# aioquic, a default dependency group, is not even attempted with
# PYHTTPD_NO_AIOQUIC set: it is especially difficult to build on some
# platforms (AIX)
nogroup=
if [ -n "${PYHTTPD_NO_AIOQUIC:-}" ]; then
nogroup="--no-group aioquic"
fi
# Packages named in PYHTTPD_SYSTEM_PACKAGES are taken from the system
# python's site-packages rather than installed, for platforms where they
# are especially difficult to build (cryptography needs Rust) but the OS
# ships them (AIX Toolbox). The venv then has to be on that python and
# see its packages.
noinstall=
if [ -n "${PYHTTPD_SYSTEM_PACKAGES:-}" ]; then
for p in $PYHTTPD_SYSTEM_PACKAGES; do
noinstall="$noinstall --no-install-package $p"
done
uv venv --project "$here" --clear --system-site-packages \
--no-managed-python --python "${PYHTTPD_PYTHON:-python3}" \
"$here/.venv"
fi
echo "runtests.sh: (re)creating $here/.venv via 'uv sync${nogroup:+ $nogroup}$noinstall'..." >&2
uv sync --project "$here" $nogroup $noinstall
# Mark the venv as freshly built so the staleness check above won't
# retrigger until pyproject.toml or uv.lock changes again.
touch "$here/.venv"
Expand Down
11 changes: 9 additions & 2 deletions test/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading