Fix: handling exceptions inside job function (#51)

This commit is contained in:
Stan Triepels
2022-12-21 01:44:59 +01:00
committed by GitHub
parent 4d454e4001
commit e78e473be3
2 changed files with 5 additions and 12 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ from django_q.tasks import (
result,
result_group,
)
from django_q.tests.tasks import multiply
from django_q.tests.tasks import multiply, TaskError
from django_q.utils import add_months, add_years
myPath = os.path.dirname(os.path.abspath(__file__))
@@ -64,7 +64,7 @@ def test_sync(broker):
@pytest.mark.django_db
def test_sync_raise_exception(broker):
with pytest.raises(Exception):
with pytest.raises(TaskError):
async_task("django_q.tests.tasks.raise_exception", broker=broker, sync=True)