mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Clear cache before going to another tests in unit tests
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user