summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-06-14 17:51:40 +0200
committerMichał Górny <mgorny@gentoo.org>2024-06-14 17:54:55 +0200
commit694cf260c304be0a7c27171b566e75bc73a737a5 (patch)
treef51f258b8742f0b64d4cc139fd2f0d1a8dc3b452 /dev-python/quart-trio
parentdev-python/quart: Enable py3.13 (diff)
downloadgentoo-694cf260c304be0a7c27171b566e75bc73a737a5.tar.gz
gentoo-694cf260c304be0a7c27171b566e75bc73a737a5.tar.bz2
gentoo-694cf260c304be0a7c27171b566e75bc73a737a5.zip
dev-python/quart-trio: Backport a test fix for new trio
Closes: https://bugs.gentoo.org/927347 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/quart-trio')
-rw-r--r--dev-python/quart-trio/files/quart-trio-0.11.1-trio-0.25.patch73
-rw-r--r--dev-python/quart-trio/quart-trio-0.11.1.ebuild5
2 files changed, 78 insertions, 0 deletions
diff --git a/dev-python/quart-trio/files/quart-trio-0.11.1-trio-0.25.patch b/dev-python/quart-trio/files/quart-trio-0.11.1-trio-0.25.patch
new file mode 100644
index 000000000000..f95a253d06e9
--- /dev/null
+++ b/dev-python/quart-trio/files/quart-trio-0.11.1-trio-0.25.patch
@@ -0,0 +1,73 @@
+From 805686abfd9963be26d59d9da9b11faddd583d11 Mon Sep 17 00:00:00 2001
+From: pgjones <philip.graham.jones@googlemail.com>
+Date: Sun, 19 May 2024 15:03:24 +0100
+Subject: [PATCH] Fix test failures
+
+Catch and extract from ExceptionGroups
+---
+ tests/test_app.py | 14 +++++++++-----
+ tests/test_basic.py | 10 ++++++++--
+ 2 files changed, 17 insertions(+), 7 deletions(-)
+
+diff --git a/tests/test_app.py b/tests/test_app.py
+index b6bffb5..1585107 100644
+--- a/tests/test_app.py
++++ b/tests/test_app.py
+@@ -51,8 +51,10 @@ async def handler(_: Exception) -> ResponseReturnValue:
+ try:
+ async with test_client.websocket("/ws/") as test_websocket:
+ await test_websocket.receive()
+- except WebsocketResponseError as error:
+- assert error.response.status_code == 201
++ except BaseExceptionGroup as error:
++ for exception in error.exceptions:
++ if isinstance(exception, WebsocketResponseError):
++ assert exception.response.status_code == 201
+
+
+ @pytest.mark.trio
+@@ -68,8 +70,10 @@ async def test_websocket_exception_group_unhandled(error_app: QuartTrio) -> None
+ try:
+ async with test_client.websocket("/ws/") as test_websocket:
+ await test_websocket.receive()
+- except WebsocketResponseError as error:
+- assert error.response.status_code == 500
++ except BaseExceptionGroup as error:
++ for exception in error.exceptions:
++ if isinstance(exception, WebsocketResponseError):
++ assert exception.response.status_code == 500
+
+
+ @pytest.mark.trio
+diff --git a/tests/test_basic.py b/tests/test_basic.py
+index 5cc4c4a..a483678 100644
+--- a/tests/test_basic.py
++++ b/tests/test_basic.py
+@@ -1,3 +1,4 @@
++import sys
+ from pathlib import Path
+
+ import pytest
+@@ -6,6 +7,9 @@
+
+ from quart_trio import QuartTrio
+
++if sys.version_info < (3, 11):
++ from exceptiongroup import BaseExceptionGroup
++
+
+ @pytest.fixture
+ def app() -> Quart:
+@@ -53,8 +57,10 @@ async def test_websocket_abort(app: Quart) -> None:
+ try:
+ async with test_client.websocket("/ws/abort/") as test_websocket:
+ await test_websocket.receive()
+- except WebsocketResponseError as error:
+- assert error.response.status_code == 401
++ except BaseExceptionGroup as error:
++ for exception in error.exceptions:
++ if isinstance(exception, WebsocketResponseError):
++ assert exception.response.status_code == 401
+
+
+ @pytest.mark.trio
diff --git a/dev-python/quart-trio/quart-trio-0.11.1.ebuild b/dev-python/quart-trio/quart-trio-0.11.1.ebuild
index b6faca070e17..f09365444ebe 100644
--- a/dev-python/quart-trio/quart-trio-0.11.1.ebuild
+++ b/dev-python/quart-trio/quart-trio-0.11.1.ebuild
@@ -37,6 +37,11 @@ BDEPEND="
distutils_enable_tests pytest
+PATCHES=(
+ # https://github.com/pgjones/quart-trio/commit/805686abfd9963be26d59d9da9b11faddd583d11
+ "${FILESDIR}/${P}-trio-0.25.patch"
+)
+
python_test() {
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
epytest -o addopts= -p trio