From b785cec844be01a3fe7ec9ab6eed0b8f76aecf3d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 3 Sep 2026 11:54:37 +0000 Subject: [PATCH 1/2] Initial plan From e69b92074fcacbd8956f642a5b9c3123c529e698 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 3 Sep 2026 11:56:28 +0000 Subject: [PATCH 2/2] Fix retryable task test decorator setup Co-authored-by: Archaeopteryx <216576+Archaeopteryx@users.noreply.github.com> --- tests/workers/test_task.py | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/tests/workers/test_task.py b/tests/workers/test_task.py index 301cf9c2f5d..53dfade0ad0 100644 --- a/tests/workers/test_task.py +++ b/tests/workers/test_task.py @@ -11,12 +11,10 @@ def count_retries(f): - thread_data.retry_count = -1 - @wraps(f) - def inner(): + def inner(*args, **kwargs): thread_data.retry_count += 1 - f() + return f(*args, **kwargs) return inner @@ -33,29 +31,43 @@ def test_retryable_task(): assert result.wait() == 10 -@retryable_task() -@count_retries -def throwing_task(): - raise TypeError +def create_throwing_task(): + thread_data.retry_count = 0 + + @retryable_task() + @count_retries + def throwing_task(): + raise TypeError + + return throwing_task def test_retryable_task_throws(): "Test celery immediately raises an error for a task that throws" + throwing_task = create_throwing_task() + with pytest.raises(TypeError): throwing_task.delay() - assert thread_data.retry_count == 0 + assert thread_data.retry_count == 1 -@retryable_task() -@count_retries -def throwing_task_should_retry(): - raise OperationalError +def create_throwing_task_should_retry(): + thread_data.retry_count = 0 + + @retryable_task() + @count_retries + def throwing_task_should_retry(): + raise OperationalError + + return throwing_task_should_retry def test_retryable_task_throws_retry(): "Test celery executes a task properly" + throwing_task_should_retry = create_throwing_task_should_retry() + with pytest.raises(Retry) as e: throwing_task_should_retry.delay() assert str(e.value) == "Retry in 10s: OperationalError()"