mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Follow review comments
This commit is contained in:
@@ -6,11 +6,6 @@ from optuna_dashboard import wsgi
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def port() -> int:
|
||||
return 8081
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def dummy_storage() -> optuna.storages.InMemoryStorage:
|
||||
storage = optuna.storages.InMemoryStorage()
|
||||
@@ -183,11 +178,13 @@ def dummy_storage() -> optuna.storages.InMemoryStorage:
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def server(
|
||||
request: pytest.FixtureRequest, dummy_storage: optuna.storages.InMemoryStorage, port: int
|
||||
) -> None:
|
||||
def server_url(
|
||||
request: pytest.FixtureRequest, dummy_storage: optuna.storages.InMemoryStorage
|
||||
) -> str:
|
||||
ip = "127.0.0.1"
|
||||
port = 38080
|
||||
app = wsgi(dummy_storage)
|
||||
httpd = make_server("127.0.0.1", port, app)
|
||||
httpd = make_server(ip, port, app)
|
||||
thread = threading.Thread(target=httpd.serve_forever)
|
||||
thread.start()
|
||||
|
||||
@@ -197,3 +194,5 @@ def server(
|
||||
thread.join()
|
||||
|
||||
request.addfinalizer(stop_server)
|
||||
|
||||
return f"http://{ip}:{port}/dashboard/"
|
||||
|
||||
@@ -8,17 +8,15 @@ def test_study_list(
|
||||
study_id: int,
|
||||
page: Page,
|
||||
dummy_storage: optuna.storages.InMemoryStorage,
|
||||
port: int,
|
||||
server: None,
|
||||
server_url: str,
|
||||
) -> None:
|
||||
page.set_viewport_size({"width": 1000, "height": 3000})
|
||||
url = f"http://localhost:{port}/dashboard/"
|
||||
|
||||
summaries = optuna.get_all_study_summaries(dummy_storage)
|
||||
study_ids = {s._study_id: s.study_name for s in summaries}
|
||||
|
||||
study_name = study_ids[study_id]
|
||||
page.goto(url)
|
||||
page.goto(server_url)
|
||||
page.click(f"a[href='/dashboard/studies/{study_id}']")
|
||||
|
||||
element = page.query_selector(".MuiTypography-body1")
|
||||
|
||||
Reference in New Issue
Block a user