debian/rules binarystarlette.io/lifespan/.
dh binary --buildsystem=pybuild
dh_update_autotools_config -O--buildsystem=pybuild
dh_autoreconf -O--buildsystem=pybuild
dh_auto_configure -O--buildsystem=pybuild
dh_auto_build -O--buildsystem=pybuild
I: pybuild plugin_pyproject:129: Building wheel for python3.12 with "build" module
I: pybuild base:305: python3.12 -m build --skip-dependency-check --no-isolation --wheel --outdir /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_asgi-lifespan
* Building wheel...
No `packages` or `py_modules` configuration, performing automatic discovery. `src-layout` detected -- analysing ./src
discovered packages -- ['asgi_lifespan', 'asgi_lifespan._concurrency'] discovered py_modules -- []
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/asgi_lifespan
copying src/asgi_lifespan/__init__.py -> build/lib/asgi_lifespan
copying src/asgi_lifespan/_types.py -> build/lib/asgi_lifespan
copying src/asgi_lifespan/_manager.py -> build/lib/asgi_lifespan
copying src/asgi_lifespan/_compat.py -> build/lib/asgi_lifespan
copying src/asgi_lifespan/_exceptions.py -> build/lib/asgi_lifespan
creating build/lib/asgi_lifespan/_concurrency
copying src/asgi_lifespan/_concurrency/__init__.py -> build/lib/asgi_lifespan/_concurrency
copying src/asgi_lifespan/_concurrency/asyncio.py -> build/lib/asgi_lifespan/_concurrency
copying src/asgi_lifespan/_concurrency/base.py -> build/lib/asgi_lifespan/_concurrency
copying src/asgi_lifespan/_concurrency/trio.py -> build/lib/asgi_lifespan/_concurrency
running egg_info
creating src/asgi_lifespan.egg-info
writing src/asgi_lifespan.egg-info/PKG-INFO
writing dependency_links to src/asgi_lifespan.egg-info/dependency_links.txt writing requirements to src/asgi_lifespan.egg-info/requires.txt
writing top-level names to src/asgi_lifespan.egg-info/top_level.txt
writing manifest file 'src/asgi_lifespan.egg-info/SOURCES.txt'
reading manifest file 'src/asgi_lifespan.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/asgi_lifespan.egg-info/SOURCES.txt'
copying src/asgi_lifespan/py.typed -> build/lib/asgi_lifespan
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/__init__.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/_types.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/py.typed -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/_manager.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/_compat.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
creating build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/__init__.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/asyncio.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/base.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/trio.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_exceptions.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
running install_egg_info
Copying src/asgi_lifespan.egg-info to build/bdist.linux-x86_64/wheel/asgi_lifespan-2.1.0.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/asgi_lifespan-2.1.0.dist-info/WHEEL creating '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_asgi-lifespan/.tmp-8wryf6qg/asgi_lifespan-2.1.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'asgi_lifespan/__init__.py'
adding 'asgi_lifespan/_compat.py'
adding 'asgi_lifespan/_exceptions.py'
adding 'asgi_lifespan/_manager.py'
adding 'asgi_lifespan/_types.py'
adding 'asgi_lifespan/py.typed'
adding 'asgi_lifespan/_concurrency/__init__.py'
adding 'asgi_lifespan/_concurrency/asyncio.py'
adding 'asgi_lifespan/_concurrency/base.py'
adding 'asgi_lifespan/_concurrency/trio.py'
adding 'asgi_lifespan-2.1.0.dist-info/LICENSE'
adding 'asgi_lifespan-2.1.0.dist-info/METADATA'
adding 'asgi_lifespan-2.1.0.dist-info/WHEEL'
adding 'asgi_lifespan-2.1.0.dist-info/top_level.txt'
adding 'asgi_lifespan-2.1.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built asgi_lifespan-2.1.0-py3-none-any.whl
I: pybuild plugin_pyproject:144: Unpacking wheel built for python3.12 with "installer" module
I: pybuild plugin_pyproject:129: Building wheel for python3.11 with "build" module
I: pybuild base:305: python3.11 -m build --skip-dependency-check --no-isolation --wheel --outdir /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_asgi-lifespan
* Building wheel...
No `packages` or `py_modules` configuration, performing automatic discovery. `src-layout` detected -- analysing ./src
discovered packages -- ['asgi_lifespan', 'asgi_lifespan._concurrency'] discovered py_modules -- []
running bdist_wheel
running build
running build_py
running egg_info
writing src/asgi_lifespan.egg-info/PKG-INFO
writing dependency_links to src/asgi_lifespan.egg-info/dependency_links.txt writing requirements to src/asgi_lifespan.egg-info/requires.txt
writing top-level names to src/asgi_lifespan.egg-info/top_level.txt
reading manifest file 'src/asgi_lifespan.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'src/asgi_lifespan.egg-info/SOURCES.txt'
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/__init__.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/_types.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/py.typed -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/_manager.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
copying build/lib/asgi_lifespan/_compat.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
creating build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/__init__.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/asyncio.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/base.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_concurrency/trio.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan/_concurrency
copying build/lib/asgi_lifespan/_exceptions.py -> build/bdist.linux-x86_64/wheel/asgi_lifespan
running install_egg_info
Copying src/asgi_lifespan.egg-info to build/bdist.linux-x86_64/wheel/asgi_lifespan-2.1.0.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/asgi_lifespan-2.1.0.dist-info/WHEEL creating '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_asgi-lifespan/.tmp-pepftofp/asgi_lifespan-2.1.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'asgi_lifespan/__init__.py'
adding 'asgi_lifespan/_compat.py'
adding 'asgi_lifespan/_exceptions.py'
adding 'asgi_lifespan/_manager.py'
adding 'asgi_lifespan/_types.py'
adding 'asgi_lifespan/py.typed'
adding 'asgi_lifespan/_concurrency/__init__.py'
adding 'asgi_lifespan/_concurrency/asyncio.py'
adding 'asgi_lifespan/_concurrency/base.py'
adding 'asgi_lifespan/_concurrency/trio.py'
adding 'asgi_lifespan-2.1.0.dist-info/LICENSE'
adding 'asgi_lifespan-2.1.0.dist-info/METADATA'
adding 'asgi_lifespan-2.1.0.dist-info/WHEEL'
adding 'asgi_lifespan-2.1.0.dist-info/top_level.txt'
adding 'asgi_lifespan-2.1.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built asgi_lifespan-2.1.0-py3-none-any.whl
I: pybuild plugin_pyproject:144: Unpacking wheel built for python3.11 with "installer" module
dh_auto_test -O--buildsystem=pybuild
I: pybuild base:305: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_asgi-lifespan/build; python3.12 -m pytest -c /dev/null --asyncio-mode=strict -p no:cacheprovider
============================= test session starts ==============================
platform linux -- Python 3.12.2, pytest-8.0.2, pluggy-1.4.0
rootdir: /dev
configfile: null
plugins: tornasync-0.6.0.post2, anyio-4.2.0, cov-4.1.0, asyncio-0.20.3, trio-0.8.0, twisted-1.14.0
asyncio: mode=Mode.STRICT
collected 32 items
../../../../../../dev/tests/test_manager.py ..........................x. [ 87%]
.xFF [100%]
=================================== FAILURES ===================================
____________________ test_lifespan_state_async_cm[asyncio] _____________________
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
/usr/lib/python3/dist-packages/httpx/_transports/default.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request
resp = await self._pool.handle_async_request(req) /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request
raise exc from None /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request
response = await connection.handle_async_request( /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:207: in handle_async_request
return await self._connection.handle_async_request(proxy_request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:99: in handle_async_request
raise exc /usr/lib/python3/dist-packages/httpcore/_async/connection.py:76: in handle_async_request
stream = await self._connect(request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:122: in _connect
stream = await self._network_backend.connect_tcp(**kwargs) /usr/lib/python3/dist-packages/httpcore/_backends/auto.py:30: in connect_tcp
return await self._backend.connect_tcp( /usr/lib/python3/dist-packages/httpcore/_backends/anyio.py:112: in connect_tcp
with map_exceptions(exc_map):
/usr/lib/python3.12/contextlib.py:158: in __exit__
self.gen.throw(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
map = {<class 'TimeoutError'>: <class 'httpcore.ConnectTimeout'>, <class 'OSError'>: <class 'httpcore.ConnectError'>, <class 'anyio.BrokenResourceError'>: <class 'httpcore.ConnectError'>}
@contextlib.contextmanager
def map_exceptions(map: ExceptionMapping) -> Iterator[None]:
try:
yield
except Exception as exc: # noqa: PIE786
for from_exc, to_exc in map.items():
if isinstance(exc, from_exc):
raise to_exc(exc) from excE httpcore.ConnectError: All connection attempts failed
/usr/lib/python3/dist-packages/httpcore/_exceptions.py:14: ConnectError
The above exception was the direct cause of the following exception:
@pytest.mark.usefixtures("concurrency")
async def test_lifespan_state_async_cm() -> None:
@contextlib.asynccontextmanager
async def lifespan(_app: ASGIApp) -> typing.AsyncGenerator:
yield {"foo": 1}
async def get(request: Request) -> Response:
assert request.state.foo == 1
request.state.foo = 2
return PlainTextResponse(f"Hello {request.state.foo}")
app = Starlette(lifespan=lifespan, routes=[Route("/get", get)])
async with LifespanManager(app) as manager:
async with httpx.AsyncClient(
app=manager.app, base_url="http://example.org"
) as client:
response = await client.get("/get")
tests/test_manager.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_client.py:1801: in get
return await self.request( /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/lib/python3/dist-packages/httpx/_client.py:1661: in send
response = await self._send_handling_auth( /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth
response = await self._send_handling_redirects( /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects
response = await self._send_single_request(request) /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request
response = await transport.handle_async_request(request) /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request
with map_httpcore_exceptions():
/usr/lib/python3.12/contextlib.py:158: in __exit__
self.gen.throw(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
except Exception as exc:
mapped_exc = None
for from_exc, to_exc in HTTPCORE_EXC_MAP.items():
if not isinstance(exc, from_exc):
continue
# We want to map to the most specific exception we can find.
# Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to
# `httpx.ReadTimeout`, not just `httpx.TimeoutException`.
if mapped_exc is None or issubclass(to_exc, mapped_exc):
mapped_exc = to_exc
if mapped_exc is None: # pragma: no cover
raise
message = str(exc)
raise mapped_exc(message) from excE httpx.ConnectError: All connection attempts failed
/usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ConnectError ______________________ test_lifespan_state_async_cm[trio] ______________________
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
/usr/lib/python3/dist-packages/httpx/_transports/default.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request
resp = await self._pool.handle_async_request(req) /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request
raise exc from None /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request
response = await connection.handle_async_request( /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:207: in handle_async_request
return await self._connection.handle_async_request(proxy_request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:99: in handle_async_request
raise exc /usr/lib/python3/dist-packages/httpcore/_async/connection.py:76: in handle_async_request
stream = await self._connect(request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:122: in _connect
stream = await self._network_backend.connect_tcp(**kwargs) /usr/lib/python3/dist-packages/httpcore/_backends/auto.py:30: in connect_tcp
return await self._backend.connect_tcp( /usr/lib/python3/dist-packages/httpcore/_backends/trio.py:130: in connect_tcp
with map_exceptions(exc_map):
/usr/lib/python3.12/contextlib.py:158: in __exit__
self.gen.throw(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
map = {<class 'trio.TooSlowError'>: <class 'httpcore.ConnectTimeout'>, <class 'trio.BrokenResourceError'>: <class 'httpcore.ConnectError'>, <class 'OSError'>: <class 'httpcore.ConnectError'>}
@contextlib.contextmanager
def map_exceptions(map: ExceptionMapping) -> Iterator[None]:
try:
yield
except Exception as exc: # noqa: PIE786
for from_exc, to_exc in map.items():
if isinstance(exc, from_exc):
raise to_exc(exc) from excE httpcore.ConnectError: all attempts to connect to 127.0.0.1:9 failed
/usr/lib/python3/dist-packages/httpcore/_exceptions.py:14: ConnectError
The above exception was the direct cause of the following exception:
@pytest.mark.usefixtures("concurrency")
async def test_lifespan_state_async_cm() -> None:
@contextlib.asynccontextmanager
async def lifespan(_app: ASGIApp) -> typing.AsyncGenerator:
yield {"foo": 1}
async def get(request: Request) -> Response:
assert request.state.foo == 1
request.state.foo = 2
return PlainTextResponse(f"Hello {request.state.foo}")
app = Starlette(lifespan=lifespan, routes=[Route("/get", get)])
async with LifespanManager(app) as manager:
async with httpx.AsyncClient(
app=manager.app, base_url="http://example.org"
) as client:
response = await client.get("/get")
tests/test_manager.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_client.py:1801: in get
return await self.request( /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/lib/python3/dist-packages/httpx/_client.py:1661: in send
response = await self._send_handling_auth( /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth
response = await self._send_handling_redirects( /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects
response = await self._send_single_request(request) /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request
response = await transport.handle_async_request(request) /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request
with map_httpcore_exceptions():
/usr/lib/python3.12/contextlib.py:158: in __exit__
self.gen.throw(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
except Exception as exc:
mapped_exc = None
for from_exc, to_exc in HTTPCORE_EXC_MAP.items():
if not isinstance(exc, from_exc):
continue
# We want to map to the most specific exception we can find.
# Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to
# `httpx.ReadTimeout`, not just `httpx.TimeoutException`.
if mapped_exc is None or issubclass(to_exc, mapped_exc):
mapped_exc = to_exc
if mapped_exc is None: # pragma: no cover
raise
message = str(exc)
raise mapped_exc(message) from excE httpx.ConnectError: all attempts to connect to 127.0.0.1:9 failed
/usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ConnectError =============================== warnings summary ===============================
tests/test_manager.py: 12 warnings
/usr/lib/python3/dist-packages/starlette/routing.py:616: DeprecationWarning: The on_startup and on_shutdown parameters are deprecated, and they will be removed on version 1.0. Use the lifespan parameter instead. See more about it on https://www.
warnings.warn(
tests/test_manager.py::test_lifespan_state_async_cm[asyncio] tests/test_manager.py::test_lifespan_state_async_cm[trio]
/usr/lib/python3/dist-packages/httpx/_client.py:1426: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=ASGITransport(app=...)' instead.
warnings.warn(message, DeprecationWarning)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================
FAILED ../../../../../../dev/tests/test_manager.py::test_lifespan_state_async_cm[asyncio]
FAILED ../../../../../../dev/tests/test_manager.py::test_lifespan_state_async_cm[trio]
============= 2 failed, 28 passed, 2 xfailed, 14 warnings in 0.95s =============
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_asgi-lifespan/build; python3.12 -m pytest -c /dev/null --asyncio-mode=strict -p no:cacheprovider
I: pybuild base:305: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_asgi-lifespan/build; python3.11 -m pytest -c /dev/null --asyncio-mode=strict -p no:cacheprovider
============================= test session starts ==============================
platform linux -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0
rootdir: /dev
configfile: null
plugins: tornasync-0.6.0.post2, anyio-4.2.0, cov-4.1.0, asyncio-0.20.3, trio-0.8.0, twisted-1.14.0
asyncio: mode=Mode.STRICT
collected 32 items
../../../../../../dev/tests/test_manager.py ..........................x. [ 87%]
.xFF [100%]
=================================== FAILURES ===================================
____________________ test_lifespan_state_async_cm[asyncio] _____________________
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
/usr/lib/python3/dist-packages/httpx/_transports/default.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request
resp = await self._pool.handle_async_request(req) /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request
raise exc from None /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request
response = await connection.handle_async_request( /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:207: in handle_async_request
return await self._connection.handle_async_request(proxy_request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:99: in handle_async_request
raise exc /usr/lib/python3/dist-packages/httpcore/_async/connection.py:76: in handle_async_request
stream = await self._connect(request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:122: in _connect
stream = await self._network_backend.connect_tcp(**kwargs) /usr/lib/python3/dist-packages/httpcore/_backends/auto.py:30: in connect_tcp
return await self._backend.connect_tcp( /usr/lib/python3/dist-packages/httpcore/_backends/anyio.py:112: in connect_tcp
with map_exceptions(exc_map):
/usr/lib/python3.11/contextlib.py:158: in __exit__
self.gen.throw(typ, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
map = {<class 'TimeoutError'>: <class 'httpcore.ConnectTimeout'>, <class 'OSError'>: <class 'httpcore.ConnectError'>, <class 'anyio.BrokenResourceError'>: <class 'httpcore.ConnectError'>}
@contextlib.contextmanager
def map_exceptions(map: ExceptionMapping) -> Iterator[None]:
try:
yield
except Exception as exc: # noqa: PIE786
for from_exc, to_exc in map.items():
if isinstance(exc, from_exc):
raise to_exc(exc) from excE httpcore.ConnectError: All connection attempts failed
/usr/lib/python3/dist-packages/httpcore/_exceptions.py:14: ConnectError
The above exception was the direct cause of the following exception:
@pytest.mark.usefixtures("concurrency")
async def test_lifespan_state_async_cm() -> None:
@contextlib.asynccontextmanager
async def lifespan(_app: ASGIApp) -> typing.AsyncGenerator:
yield {"foo": 1}
async def get(request: Request) -> Response:
assert request.state.foo == 1
request.state.foo = 2
return PlainTextResponse(f"Hello {request.state.foo}")
app = Starlette(lifespan=lifespan, routes=[Route("/get", get)])
async with LifespanManager(app) as manager:
async with httpx.AsyncClient(
app=manager.app, base_url="http://example.org"
) as client:
response = await client.get("/get")
tests/test_manager.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_client.py:1801: in get
return await self.request( /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/lib/python3/dist-packages/httpx/_client.py:1661: in send
response = await self._send_handling_auth( /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth
response = await self._send_handling_redirects( /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects
response = await self._send_single_request(request) /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request
response = await transport.handle_async_request(request) /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request
with map_httpcore_exceptions():
/usr/lib/python3.11/contextlib.py:158: in __exit__
self.gen.throw(typ, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
except Exception as exc:
mapped_exc = None
for from_exc, to_exc in HTTPCORE_EXC_MAP.items():
if not isinstance(exc, from_exc):
continue
# We want to map to the most specific exception we can find.
# Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to
# `httpx.ReadTimeout`, not just `httpx.TimeoutException`.
if mapped_exc is None or issubclass(to_exc, mapped_exc):
mapped_exc = to_exc
if mapped_exc is None: # pragma: no cover
raise
message = str(exc)
raise mapped_exc(message) from excE httpx.ConnectError: All connection attempts failed
/usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ConnectError ______________________ test_lifespan_state_async_cm[trio] ______________________
@contextlib.contextmanager
def map_httpcore_exceptions() -> typing.Iterator[None]:
try:
yield
/usr/lib/python3/dist-packages/httpx/_transports/default.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request
resp = await self._pool.handle_async_request(req) /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request
raise exc from None /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request
response = await connection.handle_async_request( /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:207: in handle_async_request
return await self._connection.handle_async_request(proxy_request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:99: in handle_async_request
raise exc /usr/lib/python3/dist-packages/httpcore/_async/connection.py:76: in handle_async_request
stream = await self._connect(request) /usr/lib/python3/dist-packages/httpcore/_async/connection.py:122: in _connect
stream = await self._network_backend.connect_tcp(**kwargs) /usr/lib/python3/dist-packages/httpcore/_backends/auto.py:30: in connect_tcp
return await self._backend.connect_tcp( /usr/lib/python3/dist-packages/httpcore/_backends/trio.py:130: in connect_tcp
with map_exceptions(exc_map):
/usr/lib/python3.11/contextlib.py:158: in __exit__
self.gen.throw(typ, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
map = {<class 'trio.TooSlowError'>: <class 'httpcore.ConnectTimeout'>, <class 'trio.BrokenResourceError'>: <class 'httpcore.ConnectError'>, <class 'OSError'>: <class 'httpcore.ConnectError'>}
@contextlib.contextmanager
def map_exceptions(map: ExceptionMapping) -> Iterator[None]:
try:
yield
except Exception as exc: # noqa: PIE786
for from_exc, to_exc in map.items():
if isinstance(exc, from_exc):
raise to_exc(exc) from excE httpcore.ConnectError: all attempts to connect to 127.0.0.1:9 failed
/usr/lib/python3/dist-packages/httpcore/_exceptions.py:14: ConnectError
The above exception was the direct cause of the following exception:
@pytest.mark.usefixtures("concurrency")
async def test_lifespan_state_async_cm() -> None:
@contextlib.asynccontextmanager
async def lifespan(_app: ASGIApp) -> typing.AsyncGenerator:
yield {"foo": 1}
async def get(request: Request) -> Response:
assert request.state.foo == 1
request.state.foo = 2
return PlainTextResponse(f"Hello {request.state.foo}")
app = Starlette(lifespan=lifespan, routes=[Route("/get", get)])
async with LifespanManager(app) as manager:
async with httpx.AsyncClient(
app=manager.app, base_url="http://example.org"
) as client:
response = await client.get("/get")
tests/test_manager.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/httpx/_client.py:1801: in get
return await self.request( /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/lib/python3/dist-packages/httpx/_client.py:1661: in send
response = await self._send_handling_auth( /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth
response = await self._send_handling_redirects(
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (2 / 14) |
Uptime: | 05:40:32 |
Calls: | 6,666 |
Files: | 12,213 |
Messages: | 5,335,958 |