Use ExceptionGroup instead of BaseExceptionGroup
This commit is contained in:
parent
122fd05e1e
commit
8f9d6003f9
|
@ -33,7 +33,7 @@ import pytest
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 11):
|
if sys.version_info[:2] < (3, 11):
|
||||||
from exceptiongroup import BaseExceptionGroup
|
from exceptiongroup import ExceptionGroup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -122,11 +122,11 @@ class UnitTestCase(Class):
|
||||||
return
|
return
|
||||||
exceptions = [exc for (_, exc, _) in exc_infos]
|
exceptions = [exc for (_, exc, _) in exc_infos]
|
||||||
# If a single exception, raise it directly as this provides a more readable
|
# If a single exception, raise it directly as this provides a more readable
|
||||||
# error.
|
# error (hopefully this will improve in #12255).
|
||||||
if len(exceptions) == 1:
|
if len(exceptions) == 1:
|
||||||
raise exceptions[0]
|
raise exceptions[0]
|
||||||
else:
|
else:
|
||||||
raise BaseExceptionGroup("Unittest class cleanup errors", exceptions)
|
raise ExceptionGroup("Unittest class cleanup errors", exceptions)
|
||||||
|
|
||||||
def unittest_setup_class_fixture(
|
def unittest_setup_class_fixture(
|
||||||
request: FixtureRequest,
|
request: FixtureRequest,
|
||||||
|
|
Loading…
Reference in New Issue