Skip to content

Commit c302caf

Browse files
feat: configure the app timeout for pytest-ipywidgets using solara-server
Can be configured using PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT
1 parent 707c712 commit c302caf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

solara/test/pytest_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
TEST_PORT_START = int(os.environ.get("PORT", "18765")) + 100 # do not interfere with the solara integration tests
3838
TEST_HOST = solara.server.settings.main.host
3939
TIMEOUT = float(os.environ.get("SOLARA_PW_TIMEOUT", "18"))
40+
PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT = int(os.environ.get("PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT", "10"))
4041

4142

4243
@pytest.fixture(scope="session")
@@ -192,7 +193,7 @@ def _solara_test(solara_server, solara_app, page_session: "playwright.sync_api.P
192193
run_events[id] = run_event = threading.Event()
193194
page_session.goto(solara_server.base_url + f"?id={id}")
194195
try:
195-
assert run_event.wait(10)
196+
assert run_event.wait(PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT)
196197
context = used_contexts[id]
197198
with context:
198199
test_output_warmup = widgets.Output()

solara/website/pages/documentation/advanced/content/10-howto/30-testing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,3 +411,7 @@ To configure the ports the socket is bound to when starting the test servers, us
411411
#### Vuetify warmup
412412

413413
By default, we insert an ipyvuetify widget with an icon into the frontend to force loading all the vuetify assets, such as CSS and fonts. However, if you are using the solara test plugin to test pure ipywidgets or a 3rd ipywidget based party library you might not need this. Disable this vuetify warmup phase by passing the `--no-solara-vuetify-warmup` argument to pytest, or setting the environment variable `SOLARA_TEST_VUETIFY_WARMUP` to a falsey value (e.g. `SOLARA_TEST_VUETIFY_WARMUP=0`).
414+
415+
#### Changing the application wait timeout
416+
417+
By default, we wait for 10 seconds for the browser to connect to the server when the solara server is used for testing. On slower systems, this may be too short. To change this timeout, set the `PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT` environment variable to the desired value in seconds (e.g. `PYTEST_IPYWIDGETS_SOLARA_APP_WAIT_TIMEOUT=20`).

0 commit comments

Comments
 (0)