Parcourir la source

avoid warnings in tests

Falko Schindler il y a 2 ans
Parent
commit
af01528584
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      nicegui/elements/element.py

+ 4 - 1
nicegui/elements/element.py

@@ -112,5 +112,8 @@ class Element:
         return self
 
     def update(self) -> None:
-        if asyncio.get_event_loop().is_running():
+        try:
+            asyncio.get_running_loop()
+        except RuntimeError:
+            return
             create_task(self.view.update())