Skip to content

Commit 8f8ee48

Browse files
committed
fix: 실패하는 테스트 수정
1 parent ce17fb3 commit 8f8ee48

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

app/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
from core.util.thread_local import thread_local
2+
from django.core.cache import cache
23
from django.test import override_settings
34
from pytest import fixture
45

56

7+
@fixture(autouse=True)
8+
def _clear_cache():
9+
# /api/schema 는 cache_page 로 LocMemCache 에 캐시되는데, 캐시는 DB 와 달리 테스트 간 롤백되지 않는다.
10+
# 먼저 실행된 테스트가 만든 스키마(예: SocialApp 없는 상태로 생성된 provider enum 누락분)가 누출되므로 매 테스트 격리.
11+
cache.clear()
12+
yield
13+
14+
615
@fixture(autouse=True)
716
def _celery_eager():
817
with override_settings(CELERY_TASK_ALWAYS_EAGER=True, CELERY_TASK_EAGER_PROPAGATES=False):

0 commit comments

Comments
 (0)