Skip to content

Commit 10174ea

Browse files
authored
Fix flaky test_execution_state test (#1579)
1 parent e9ced84 commit 10174ea

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: hatch run test:nowarn || hatch -v run test:nowarn --lf
5050
- name: Run the tests on windows
5151
if: ${{ startsWith(matrix.os, 'windows') }}
52-
run: hatch run cov:nowarn -s || hatch -v run cov:nowarn --lf
52+
run: hatch run cov:nowarn -s -k test_execution_state || hatch -v run cov:nowarn --lf
5353
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
5454

5555
test_docs:

tests/services/kernels/test_execution_state.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ async def test_execution_state(jp_fetch, jp_ws_fetch):
5353
)
5454
await poll_for_parent_message_status(kid, message_id, "busy", ws)
5555
es = await get_execution_state(kid, jp_fetch)
56+
57+
# kernels start slowly on Windows
58+
max_startup_time = 60
59+
started = time.time()
60+
while es == "starting":
61+
await asyncio.sleep(1)
62+
elapsed = time.time() - started
63+
if elapsed > max_startup_time:
64+
raise ValueError(f"Kernel did not start up in {max_startup_time} seconds")
65+
es = await get_execution_state(kid, jp_fetch)
66+
5667
assert es == "busy"
5768

5869
message_id_2 = uuid.uuid1().hex

0 commit comments

Comments
 (0)