summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-anyio-unuse-exceptiongroup-in-test.patch
blob: 2fc358dbbf158395ab01f2a8e6786c881ac55ce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
commit 0df0045987436d9eef2c477ecc13ebea65205e1f
Author: Nguyễn Gia Phong <cnx@loang.net>
Date:   2026-01-21 13:23:43 +0900

    Unuse exceptiongroup in test

diff --git a/pyproject.toml b/pyproject.toml
index dd1c0a3460a9..963da45d4ee8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -48,7 +48,7 @@ pytest11 = {anyio = "anyio.pytest_plugin"}
 test = [
     "blockbuster >= 1.5.23",
     "coverage[toml] >= 7",
-    "exceptiongroup >= 1.2.0",
+    "exceptiongroup >= 1.2.0; python_version < '3.11'",
     "hypothesis >= 4.18.2",
     "psutil >= 5.9",
     "pytest >= 7.0",
diff --git a/tests/test_taskgroups.py b/tests/test_taskgroups.py
index b747f7291a4c..036ab9fcbeca 100644
--- a/tests/test_taskgroups.py
+++ b/tests/test_taskgroups.py
@@ -11,7 +11,6 @@ from typing import Any, NoReturn, cast
 from unittest import mock
 
 import pytest
-from exceptiongroup import catch
 from pytest import FixtureRequest, MonkeyPatch
 
 import anyio
@@ -1550,13 +1549,12 @@ async def test_cancel_before_entering_task_group() -> None:
 
 
 async def test_reraise_cancelled_in_excgroup() -> None:
-    def handler(excgrp: BaseExceptionGroup) -> None:
-        raise
-
     with CancelScope() as scope:
         scope.cancel()
-        with catch({get_cancelled_exc_class(): handler}):
+        try:
             await anyio.sleep_forever()
+        except* get_cancelled_exc_class():
+            raise
 
 
 async def test_cancel_child_task_when_host_is_shielded() -> None: