Skip to content

Commit

Permalink
Fixes for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks committed Dec 30, 2024
1 parent 4857444 commit 2a14f10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions newsfragments/3175.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Warn if a user forgot to implement ``.derive`` for an ExceptionGroup subclass.
2 changes: 1 addition & 1 deletion src/trio/_core/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
)

if sys.version_info < (3, 11):
from exceptiongroup import BaseExceptionGroup
from exceptiongroup import BaseExceptionGroup, ExceptionGroup


if TYPE_CHECKING:
Expand Down
8 changes: 5 additions & 3 deletions src/trio/_core/_tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import weakref
from contextlib import ExitStack, contextmanager, suppress
from math import inf, nan
from typing import TYPE_CHECKING, NoReturn, Self, TypeVar
from typing import TYPE_CHECKING, NoReturn, TypeVar
from unittest import mock

import outcome
Expand Down Expand Up @@ -47,6 +47,8 @@
Sequence,
)

from typing_extensions import Self

if sys.version_info < (3, 11):
from exceptiongroup import BaseExceptionGroup, ExceptionGroup

Expand Down Expand Up @@ -2859,7 +2861,7 @@ def run(self, fn: Callable[[], object]) -> object:


def test_run_with_custom_exception_group() -> None:
class ExceptionGroupForTest(ExceptionGroup):
class ExceptionGroupForTest(ExceptionGroup[Exception]):
@staticmethod
def for_test(message: str, excs: list[Exception]) -> ExceptionGroupForTest:
raise NotImplementedError()
Expand Down Expand Up @@ -2897,7 +2899,7 @@ def for_test(message: str, excs: list[Exception]) -> AbnormalNew:
return AbnormalNew(excs)

for check in (check1, check2, check3):
for error in (HasDerive, NormalNew, AbnormalNew):
for error in [HasDerive, NormalNew, AbnormalNew]:
if check is check3:
if error in (NormalNew, AbnormalNew):
with (
Expand Down

0 comments on commit 2a14f10

Please sign in to comment.