-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1162 from procrastinate-org/wrap-django-errors
- Loading branch information
Showing
6 changed files
with
80 additions
and
41 deletions.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,20 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
from django import db as django_db | ||
from psycopg import errors as psycopg_errors | ||
|
||
from procrastinate import exceptions | ||
from procrastinate.contrib.django import django_connector as django_connector_module | ||
|
||
|
||
def test_wrap_exceptions__no_cause(): | ||
with pytest.raises(django_db.DatabaseError): | ||
with django_connector_module.wrap_exceptions(): | ||
raise django_db.DatabaseError | ||
|
||
|
||
def test_wrap_exceptions__with_cause(): | ||
with pytest.raises(exceptions.ConnectorException): | ||
with django_connector_module.wrap_exceptions(): | ||
raise django_db.DatabaseError from psycopg_errors.Error() |