Skip to content

Fix retryable task tests by correcting decorator composition and per-test retry counter setup - #9845

Draft
Archaeopteryx with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-test-retryable-task-order-initialization
Draft

Fix retryable task tests by correcting decorator composition and per-test retry counter setup#9845
Archaeopteryx with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-test-retryable-task-order-initialization

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown

test_retryable_task_throws and test_retryable_task_throws_retry regressed due to decorator composition that returned plain functions (losing .delay()), plus retry counter state initialized at module load. This updates test task construction so Celery wrapping remains outermost and retry counting is initialized per test instance.

  • Decorator composition (Celery task integrity)

    • Ensure @count_retries is applied to the raw function, with @retryable_task() outermost, so the exported object is still a Celery task and supports .delay().
  • Retry counter isolation

    • Move thread_data.retry_count initialization out of decorator definition time and into task factory functions used by each test.
    • Eliminate shared module-load initialization side effects between tests.
  • Counter semantics cleanup

    • Simplify count_retries to increment from 0 by +1 per invocation.
    • Update wrapper to pass through *args/**kwargs and return the wrapped function result.
  • Test task setup updates

    • Replace module-level throwing task declarations with create_throwing_task() and create_throwing_task_should_retry() factories.
    • Align assertions with explicit per-call counting.
def create_throwing_task():
    thread_data.retry_count = 0

    @retryable_task()
    @count_retries
    def throwing_task():
        raise TypeError

    return throwing_task

@netlify

netlify Bot commented Sep 3, 2026

Copy link
Copy Markdown

Deploy Preview for treeherder ready!

Name Link
🔨 Latest commit e69b920
🔍 Latest deploy log https://app.netlify.com/projects/treeherder/deploys/6a9960709f0f3d000806f7d2
😎 Deploy Preview https://deploy-preview-9845--treeherder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: Archaeopteryx <216576+Archaeopteryx@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix decorator order and initialization in retryable task tests Fix retryable task tests by correcting decorator composition and per-test retry counter setup Sep 3, 2026
Copilot AI requested a review from Archaeopteryx September 3, 2026 11:57
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.85%. Comparing base (050fedf) to head (e69b920).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9845   +/-   ##
=======================================
  Coverage   83.85%   83.85%           
=======================================
  Files         643      643           
  Lines       39269    39276    +7     
  Branches     3502     3502           
=======================================
+ Hits        32929    32936    +7     
  Misses       5950     5950           
  Partials      390      390           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants