Skip to content

Commit 0468583

Browse files
Aviad Rozenhekclaude
andcommitted
Bind both histories with process_handoffs= (pytest-obligation 0.20.0)
pytest-obligation 0.20.0 binds several worker histories directly, so the contract no longer copies the chord onto a one-history contract, and history=/gap= (deprecated there) are gone from it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a180883 commit 0468583

2 files changed

Lines changed: 19 additions & 26 deletions

File tree

‎requirements/test-due-work.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# t/due_work: Celery's worker checked with pytest-obligation, which needs Python 3.11 or later.
2-
pytest-obligation>=0.19.2; python_version >= "3.11"
2+
pytest-obligation>=0.20.0; python_version >= "3.11"
33
redis

‎t/due_work/test_worker_contract.py‎

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -149,31 +149,24 @@ def settled(task_id):
149149

150150
CONTRACT = worker_contract(
151151
name='celery: the worker running a task',
152-
history=SEND_MESSAGE,
153-
gap=(
154-
'once the link is published, a failure still runs the failure path: a child lost after the link, before '
155-
'the store, records FAILURE for a task whose effect and link happened, and fires the error callback '
156-
'beside the link (https://github.com/celery/celery/issues/10949); and a link the broker refuses records '
157-
'FAILURE and acknowledges the message, so the link is never sent '
158-
'(https://github.com/celery/celery/issues/10725). '
159-
'FINDINGS pins each history'
160-
),
161-
)
162-
# worker_contract binds one history; the chord is a second process handoff of the same contract.
163-
CONTRACT = CONTRACT.model_copy(
164-
update={
165-
'process_handoffs': (*CONTRACT.process_handoffs, CHORD),
166-
'handoff_gaps': {
167-
**CONTRACT.handoff_gaps,
168-
CHORD.name: (
169-
'a chord whose body the broker refuses, or whose header task is lost after its effect and before '
170-
'its store, fails for good with ChordError though every message was sent; the body never runs '
171-
'(https://github.com/celery/celery/issues/10725#issuecomment-6318108091, '
172-
'https://github.com/celery/celery/issues/10949). '
173-
'CHORD_FINDINGS pins each history'
174-
),
175-
},
176-
}
152+
process_handoffs=(SEND_MESSAGE, CHORD),
153+
handoff_gaps={
154+
SEND_MESSAGE.name: (
155+
'once the link is published, a failure still runs the failure path: a child lost after the link, before '
156+
'the store, records FAILURE for a task whose effect and link happened, and fires the error callback '
157+
'beside the link (https://github.com/celery/celery/issues/10949); and a link the broker refuses records '
158+
'FAILURE and acknowledges the message, so the link is never sent '
159+
'(https://github.com/celery/celery/issues/10725). '
160+
'FINDINGS pins each history'
161+
),
162+
CHORD.name: (
163+
'a chord whose body the broker refuses, or whose header task is lost after its effect and before '
164+
'its store, fails for good with ChordError though every message was sent; the body never runs '
165+
'(https://github.com/celery/celery/issues/10725#issuecomment-6318108091, '
166+
'https://github.com/celery/celery/issues/10949). '
167+
'CHORD_FINDINGS pins each history'
168+
),
169+
},
177170
)
178171

179172

0 commit comments

Comments
 (0)