Skip to content

Commit cd9f527

Browse files
committed
fix flaky test
1 parent 3c7a496 commit cd9f527

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/py/reactpy/reactpy/testing/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def until(
6767
break
6868
elif (time.time() - started_at) > timeout: # nocov
6969
msg = f"Expected {description} after {timeout} seconds - last value was {result!r}"
70-
raise TimeoutError(msg)
70+
raise asyncio.TimeoutError(msg)
7171

7272
async def until_is(
7373
self,

src/py/reactpy/tests/test_core/test_hooks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,11 @@ def SetStateDuringRender():
10371037
# we expect a second render to be triggered in the background
10381038
await poll(lambda: render_count.current).until_equals(2)
10391039

1040-
# there should be no more renders that happen
1041-
with pytest.raises(asyncio.TimeoutError):
1042-
await poll(lambda: render_count.current).until_equals(3, timeout=0.1)
1040+
# give an opportunity for a render to happen if it were to.
1041+
await asyncio.sleep(0.1)
1042+
1043+
# however, we don't expect any more renders
1044+
assert render_count.current == 2
10431045

10441046

10451047
@pytest.mark.skipif(not REACTPY_DEBUG_MODE.current, reason="only logs in debug mode")

0 commit comments

Comments
 (0)