Skip to content

Commit 2903945

Browse files
Merge pull request #746 from keisuke-umezawa/feature/clear-cache-when-terminating
Clear in-memory cache when terminating test
2 parents 7c4f673 + be2c334 commit 2903945

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

e2e_tests/test_dashboard/test_usecases/test_preferential_optimization.py

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import pytest
1010

1111
from ...test_server import make_test_server
12-
from ...utils import clear_inmemory_cache
1312

1413

1514
def make_test_storage() -> optuna.storages.InMemoryStorage:
@@ -44,7 +43,6 @@ def make_test_storage() -> optuna.storages.InMemoryStorage:
4443

4544
@pytest.fixture
4645
def storage() -> optuna.storages.InMemoryStorage:
47-
clear_inmemory_cache()
4846
storage = make_test_storage()
4947
return storage
5048

e2e_tests/test_dashboard/test_usecases/test_study_history.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pytest
44

55
from ...test_server import make_test_server
6-
from ...utils import clear_inmemory_cache
76

87

98
def make_test_storage() -> optuna.storages.InMemoryStorage:
@@ -24,7 +23,6 @@ def objective_single(trial: optuna.Trial) -> float:
2423

2524
@pytest.fixture
2625
def storage() -> optuna.storages.InMemoryStorage:
27-
clear_inmemory_cache()
2826
storage = make_test_storage()
2927
return storage
3028

e2e_tests/test_dashboard/visual_regression_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
import pytest
66

77
from ..test_server import make_test_server
8-
from ..utils import clear_inmemory_cache
98

109

1110
@pytest.fixture
1211
def storage() -> optuna.storages.InMemoryStorage:
13-
clear_inmemory_cache()
1412
storage = optuna.storages.InMemoryStorage()
1513
return storage
1614

e2e_tests/test_server.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from optuna_dashboard import wsgi
99
import pytest
1010

11+
from .utils import clear_inmemory_cache
12+
1113

1214
def get_free_port() -> int:
1315
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -28,6 +30,7 @@ def make_test_server(
2830
thread.start()
2931

3032
def stop_server() -> None:
33+
clear_inmemory_cache()
3134
httpd.shutdown()
3235
httpd.server_close()
3336
thread.join()

0 commit comments

Comments
 (0)