mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Clear cache for other tests as well
This commit is contained in:
@@ -9,6 +9,7 @@ from playwright.sync_api import Page
|
||||
import pytest
|
||||
|
||||
from ...test_server import make_test_server
|
||||
from ...utils import clear_inmemory_cache
|
||||
|
||||
|
||||
def make_test_storage() -> optuna.storages.InMemoryStorage:
|
||||
@@ -43,6 +44,7 @@ def make_test_storage() -> optuna.storages.InMemoryStorage:
|
||||
|
||||
@pytest.fixture
|
||||
def storage() -> optuna.storages.InMemoryStorage:
|
||||
clear_inmemory_cache()
|
||||
storage = make_test_storage()
|
||||
return storage
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from playwright.sync_api import Page
|
||||
import pytest
|
||||
|
||||
from ...test_server import make_test_server
|
||||
from ...utils import clear_inmemory_cache
|
||||
|
||||
|
||||
def make_test_storage() -> optuna.storages.InMemoryStorage:
|
||||
@@ -23,6 +24,7 @@ def make_test_storage() -> optuna.storages.InMemoryStorage:
|
||||
|
||||
@pytest.fixture
|
||||
def storage() -> optuna.storages.InMemoryStorage:
|
||||
clear_inmemory_cache()
|
||||
storage = make_test_storage()
|
||||
return storage
|
||||
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
from typing import Callable
|
||||
|
||||
import optuna
|
||||
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 playwright.sync_api import Page
|
||||
import pytest
|
||||
|
||||
from ..test_server import make_test_server
|
||||
|
||||
|
||||
def clear_inmemory_cache() -> None:
|
||||
with trials_cache_lock:
|
||||
trials_cache.clear()
|
||||
trials_last_fetched_at.clear()
|
||||
from ..utils import clear_inmemory_cache
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
from optuna_dashboard._storage import trials_cache
|
||||
from optuna_dashboard._storage import trials_cache_lock
|
||||
from optuna_dashboard._storage import trials_last_fetched_at
|
||||
|
||||
|
||||
def clear_inmemory_cache() -> None:
|
||||
with trials_cache_lock:
|
||||
trials_cache.clear()
|
||||
trials_last_fetched_at.clear()
|
||||
Reference in New Issue
Block a user