Explorar o código

trying alternative implementation of test
to fix flakyness

Rodja Trappe %!s(int64=2) %!d(string=hai) anos
pai
achega
93bcb8490c
Modificáronse 1 ficheiros con 3 adicións e 6 borrados
  1. 3 6
      tests/test_auto_context.py

+ 3 - 6
tests/test_auto_context.py

@@ -92,16 +92,13 @@ def test_autoupdate_on_async_event_handler(screen: Screen):
 def test_autoupdate_on_async_timer_callback(screen: Screen):
     async def update():
         ui.label('1')
-        await asyncio.sleep(3.0)
+        await asyncio.sleep(1.0)
         ui.label('2')
     ui.label('0')
-    ui.timer(2.0, update, once=True)
-
-    app.on_startup(lambda: ui.label('connection established'))  # HACK: allow waiting for client connection
+    ui.button('start', on_click=lambda: ui.timer(2.0, update, once=True))
 
     screen.open('/')
-    with screen.implicitly_wait(10.0):
-        screen.wait_for('connection established')
+    screen.click('start')
     screen.should_contain('0')
     screen.should_not_contain('1')
     screen.wait_for('1')