commit:     a817b977fe91b3202ef9bc3272a6e552a66ec3e8
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 15 17:43:06 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed May 15 17:53:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a817b977

dev-python/httpx: Enable py3.13

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/httpx/files/httpx-0.27.0-opt-trio.patch | 17 +++++++++++++++++
 dev-python/httpx/httpx-0.27.0.ebuild               | 17 ++++++++++++++---
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/dev-python/httpx/files/httpx-0.27.0-opt-trio.patch 
b/dev-python/httpx/files/httpx-0.27.0-opt-trio.patch
new file mode 100644
index 000000000000..6c2c9e67255f
--- /dev/null
+++ b/dev-python/httpx/files/httpx-0.27.0-opt-trio.patch
@@ -0,0 +1,17 @@
+diff --git a/tests/concurrency.py b/tests/concurrency.py
+index a8ed558..d5ce803 100644
+--- a/tests/concurrency.py
++++ b/tests/concurrency.py
+@@ -5,11 +5,11 @@ Async environment-agnostic concurrency utilities that are 
only used in tests.
+ import asyncio
+ 
+ import sniffio
+-import trio
+ 
+ 
+ async def sleep(seconds: float) -> None:
+     if sniffio.current_async_library() == "trio":
++        import trio
+         await trio.sleep(seconds)  # pragma: no cover
+     else:
+         await asyncio.sleep(seconds)

diff --git a/dev-python/httpx/httpx-0.27.0.ebuild 
b/dev-python/httpx/httpx-0.27.0.ebuild
index 108c55923dff..0a648891634c 100644
--- a/dev-python/httpx/httpx-0.27.0.ebuild
+++ b/dev-python/httpx/httpx-0.27.0.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=hatchling
-PYTHON_COMPAT=( pypy3 python3_{10..12} )
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
 
 inherit distutils-r1 optfeature
 
@@ -44,16 +44,22 @@ BDEPEND="
                dev-python/cryptography[${PYTHON_USEDEP}]
                dev-python/h2[${PYTHON_USEDEP}]
                dev-python/socksio[${PYTHON_USEDEP}]
-               dev-python/trio[${PYTHON_USEDEP}]
                dev-python/trustme[${PYTHON_USEDEP}]
                dev-python/typing-extensions[${PYTHON_USEDEP}]
                dev-python/uvicorn[${PYTHON_USEDEP}]
+               $(python_gen_cond_dep '
+                       dev-python/trio[${PYTHON_USEDEP}]
+               ' 3.{10..12})
        )
 "
 
 distutils_enable_tests pytest
 
 src_prepare() {
+       local PATCHES=(
+               "${FILESDIR}/${P}-opt-trio.patch"
+       )
+
        if ! use cli; then
                sed -i -e '/^httpx =/d' pyproject.toml || die
        fi
@@ -63,6 +69,7 @@ src_prepare() {
 }
 
 python_test() {
+       local args=()
        local EPYTEST_DESELECT=(
                # Internet
                tests/client/test_proxies.py::test_async_proxy_close
@@ -73,7 +80,11 @@ python_test() {
                tests/test_main.py
        )
 
-       epytest
+       if ! has_version "dev-python/trio[${PYTHON_USEDEP}]"; then
+               args+=( -o filterwarnings= -k "not trio" )
+       fi
+
+       epytest "${args[@]}"
 }
 
 pkg_postinst() {

Reply via email to