Skip to content

Commit

Permalink
feat(tests): auto eager celery tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamad-liyaghi committed Aug 5, 2024
1 parent 32f07b4 commit 49beb77
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest # noqa
from rest_framework.test import APIClient
from config.celery import celery
from apps.users.tests.fixtures import * # noqa
from apps.active_sessions.tests.fixtures import * # noqa
from apps.locations.tests.fixtures import * # noqa
Expand All @@ -10,3 +11,13 @@
@pytest.fixture(scope="class")
def api_client() -> APIClient:
return APIClient()


@pytest.fixture(autouse=True, scope="session")
def disable_celery_tasks():
"""
Disable celery tasks for all tests.
"""
celery.conf.CELERY_ALWAYS_EAGER = True
yield
celery.conf.CELERY_ALWAYS_EAGER = False

0 comments on commit 49beb77

Please sign in to comment.