Coverage for baibu/conftest.py: 100%
16 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-10-06 13:07 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-10-06 13:07 +0000
1import pytest
3from baibu.users.models import User
4from baibu.users.tests.factories import UserFactory
7@pytest.fixture(autouse=True)
8def _media_storage(settings, tmpdir) -> None:
9 settings.MEDIA_ROOT = tmpdir.strpath
10 # A fresh in-memory store for each test (changing STORAGES resets them).
11 settings.STORAGES = {**settings.STORAGES, "private": {"BACKEND": "django.core.files.storage.InMemoryStorage"}}
14@pytest.fixture(autouse=True)
15def _clear_cache():
16 from django.core.cache import cache
18 cache.clear()
19 yield
20 cache.clear()
23@pytest.fixture
24def user(db) -> User:
25 return UserFactory()