-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconftest.py
37 lines (31 loc) · 1 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pytest # noqa
from rest_framework.test import APIClient
from django.core.cache import cache
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
from apps.restaurants.tests.fixtures import * # noqa
from apps.products.tests.fixtures import * # noqa
from apps.transactions.tests.fixtures import * # noqa
from apps.orders.tests.fixtures import * # noqa
from apps.carts.tests.fixtures import * # noqa
@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
@pytest.fixture(autouse=True, scope="class")
def clear_cache():
"""
Clear cache for all tests.
"""
cache.clear()
yield
cache.clear()