Skip to content

Commit 067dfc9

Browse files
obbardcauvipy
authored andcommitted
Fix test_database AttributeError on ignore_result with Celery 5.x
The protocol 1 test requests are built via hybrid_to_proto2() which does not include 'ignore_result' in the message headers. Celery 5.x's Request.__init__ reads 'ignore_result' from the headers and, when absent, falls back to self._task.ignore_result. Since these tests pass the task name rather than a task object, it causes an error: AttributeError: 'str' object has no attribute 'ignore_result' Set the 'ignore_result' header to False in _create_request() so the fallback is never use. This is a no-op for protocol 2 (which already sets the header) and keeps request.task as the 'my_task' string, preserving the existing task_name assertions. Closes: #508 Signed-off-by: Christopher Obbard <obbardc@debian.org>
1 parent a895b97 commit 067dfc9

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

t/unit/backends/test_database.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def _create_request(self, task_id, name, args, kwargs,
5252
sent_event = {}
5353
else:
5454
headers, properties, body, sent_event = msg
55+
headers.setdefault('ignore_result', False)
5556
context = Context(
5657
headers=headers,
5758
properties=properties,

0 commit comments

Comments
 (0)