-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: do not wrap
CancelledError
into BackendError
🐛
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from asyncio import CancelledError | ||
|
||
import pytest | ||
|
||
from combadge.core.errors import BackendError | ||
|
||
|
||
@pytest.mark.parametrize("inner_exception", [ValueError(42)]) | ||
def test_wrapped(inner_exception: BaseException) -> None: | ||
with pytest.raises(BackendError), BackendError: | ||
raise inner_exception | ||
|
||
|
||
@pytest.mark.parametrize("inner_exception", [CancelledError()]) | ||
def test_non_wrapped(inner_exception: BaseException) -> None: | ||
with pytest.raises(type(inner_exception)), BackendError: | ||
raise inner_exception |