close
Skip to content

Closes #22318: Add tearDown to clear RQ queues after tests#22320

Open
pheus wants to merge 1 commit into
mainfrom
22318-backgroundtasktestcase-api-tests-lacks-teardown-leaking
Open

Closes #22318: Add tearDown to clear RQ queues after tests#22320
pheus wants to merge 1 commit into
mainfrom
22318-backgroundtasktestcase-api-tests-lacks-teardown-leaking

Conversation

@pheus
Copy link
Copy Markdown
Contributor

@pheus pheus commented May 28, 2026

Closes: #22318

Clear all RQ queues in tearDown to prevent job leakage between test suites. Previously queues were only flushed in setUp, allowing jobs from one test to persist and affect later unrelated test runs.

Clear all RQ queues in tearDown to prevent job leakage between test
suites. Previously queues were only flushed in setUp, allowing jobs
from one test to persist and affect later unrelated test runs.

Fixes #22318
@pheus pheus marked this pull request as ready for review May 28, 2026 15:36
@pheus pheus requested review from a team and arthanson and removed request for a team May 28, 2026 15:36
Copy link
Copy Markdown
Collaborator

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that same setup code is in test_views, wondering if you looked at adding it there as well?

Also test_jobs has the teardown but doesn't clear in the setup - also wondering if it would make sense to just be a mixin for the tests that has the setup and teardown logic for clearing the queues, maybe a bit more DRY.

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.

BackgroundTaskTestCase (API tests) lacks teardown, leaking django-rq state into later test suites

2 participants