Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfc: in-memory Celery backend for tests #3151

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dato
Copy link
Contributor

@dato dato commented Dec 12, 2023

The use of Redis is avoided in tests by mocking the .delay method of relevant Celery tasks. An alternative would be to run tests with an in-memory Celery backend, and let task objects be created there.

This PR implements this, but it doesn't touch any existing patch('...') block. (I think it best to do that in a separate PR, if at all.)

But from the moment this is merged, patch blocks would not be needed in new code.

  • in-memory backend when running from pytest
  • in-memory backend when running from manage.py
  • check test suite runtime if all mocks are dropped
  • add an example worker test

This allows to easily configure an in-memory transport for tests.
At the moment, this doesn't have much of an effect since most task
calls are mock'd out.
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.

None yet

1 participant