Clear cache before going to another tests in unit tests

This commit is contained in:
nabenabe0928
2023-12-07 07:46:52 +01:00
parent e25d42ea91
commit c0df7dc3d8
@@ -4,11 +4,22 @@ import optuna
from playwright.sync_api import Page
import pytest
from optuna_dashboard._storage import trials_cache
from optuna_dashboard._storage import trials_cache_lock
from optuna_dashboard._storage import trials_last_fetched_at
from ..test_server import make_test_server
def clear_inmemory_cache() -> None:
with trials_cache_lock:
trials_cache.clear()
trials_last_fetched_at.clear()
@pytest.fixture
def storage() -> optuna.storages.InMemoryStorage:
clear_inmemory_cache()
storage = optuna.storages.InMemoryStorage()
return storage