Don't raise an exception at the end of a task if we are running unit tests

This commit is contained in:
Matthew Jones
2014-01-30 11:36:54 -05:00
parent 280527f993
commit bf8c4b289a
3 changed files with 2 additions and 2 deletions

View File

@@ -307,7 +307,7 @@ class BaseTask(Task):
result_traceback=tb,
output_replacements=output_replacements)
self.post_run_hook(instance, **kwargs)
if status != 'successful':
if status != 'successful' and not has hasattr(settings, 'CELERY_UNIT_TEST'):
# Raising an exception will mark the job as 'failed' in celery
# and will stop a task chain from continuing to execute
raise Exception("Task %s(pk:%s) encountered an error" % (str(self.model.__class__), str(pk)))