Skip to content
Myr

Improve robustness of live HTTP/2 test (#512)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Florimond Manca · committed by GitHub · parent 95b2b24 · Browse files · 1 file+9 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−3 removed

  • tests:+9 added−3 removed

1 file+9 added−3 removed

modified:tests/dispatch/test_http2.py+9 added-3 removed
1import json2import socket34import h2.connection5import h2.events6import pytest7from h2.settings import SettingCodes87from httpx import AsyncClient, Client, Response9from httpx import AsyncClient, Client, Response, Timeout1011from .utils import MockHTTP2Backend1213
195 unmodified lines
209210211async def test_http2_live_request(backend):212 async with AsyncClient(backend=backend) as client:211 resp = await client.get("https://nghttp2.org/httpbin/anything")212213 try:214 resp = await client.get("https://nghttp2.org/httpbin/anything")215 except Timeout:216 pytest.xfail(reason="nghttp2.org appears to be unresponsive")217 except socket.gaierror:218 pytest.xfail(reason="You appear to be offline")219 assert resp.status_code == 200220 assert resp.http_version == "HTTP/2"