projects/aports·blob master · refs

30 lines · 879 B

1Since exceptiongroup is not packaged in Alpine, rewrite test using
2native Python 3.11+ syntax.
3
4--- a/tests/test_taskgroups.py
5+++ b/tests/test_taskgroups.py
6@@ -11,7 +11,6 @@ from typing import Any, NoReturn, cast
7 from unittest import mock
8
9 import pytest
10-from exceptiongroup import catch
11 from pytest import FixtureRequest, MonkeyPatch
12
13 import anyio
14@@ -1549,13 +1548,12 @@ async def test_cancel_before_entering_task_group() -> None:
15
16
17 async def test_reraise_cancelled_in_excgroup() -> None:
18- def handler(excgrp: BaseExceptionGroup) -> None:
19- raise
20-
21 with CancelScope() as scope:
22 scope.cancel()
23- with catch({get_cancelled_exc_class(): handler}):
24+ try:
25 await anyio.sleep_forever()
26+ except* get_cancelled_exc_class():
27+ raise
28
29
30 async def test_cancel_child_task_when_host_is_shielded() -> None: