1010
1111from typing_extensions import ParamSpec , Protocol
1212
13- from idom .config import IDOM_WEB_MODULES_DIR
13+ from idom .config import IDOM_TESTING_DEFAULT_TIMEOUT , IDOM_WEB_MODULES_DIR
1414from idom .core .events import EventHandler , to_event_handler_function
1515from idom .core .hooks import LifeCycleHook , current_hook
1616
@@ -24,13 +24,10 @@ def clear_idom_web_modules_dir() -> None:
2424_P = ParamSpec ("_P" )
2525_R = TypeVar ("_R" )
2626_RC = TypeVar ("_RC" , covariant = True )
27- _DEFAULT_TIMEOUT = 3.0
2827
2928
3029class _UntilFunc (Protocol [_RC ]):
31- def __call__ (
32- self , condition : Callable [[_RC ], bool ], timeout : float = _DEFAULT_TIMEOUT
33- ) -> Any :
30+ def __call__ (self , condition : Callable [[_RC ], bool ], timeout : float = ...) -> Any :
3431 ...
3532
3633
@@ -50,7 +47,8 @@ def __init__(
5047 coro_function = cast (Callable [_P , Awaitable [_R ]], function )
5148
5249 async def coro_until (
53- condition : Callable [[_R ], bool ], timeout : float = _DEFAULT_TIMEOUT
50+ condition : Callable [[_R ], bool ],
51+ timeout : float = IDOM_TESTING_DEFAULT_TIMEOUT .current ,
5452 ) -> None :
5553 started_at = time .time ()
5654 while True :
@@ -68,7 +66,8 @@ async def coro_until(
6866 sync_function = cast (Callable [_P , _R ], function )
6967
7068 def sync_until (
71- condition : Callable [[_R ], bool ] | Any , timeout : float = _DEFAULT_TIMEOUT
69+ condition : Callable [[_R ], bool ] | Any ,
70+ timeout : float = IDOM_TESTING_DEFAULT_TIMEOUT .current ,
7271 ) -> None :
7372 started_at = time .time ()
7473 while True :
@@ -83,11 +82,19 @@ def sync_until(
8382
8483 self .until = sync_until
8584
86- def until_is (self , right : Any , timeout : float = _DEFAULT_TIMEOUT ) -> Any :
85+ def until_is (
86+ self ,
87+ right : Any ,
88+ timeout : float = IDOM_TESTING_DEFAULT_TIMEOUT .current ,
89+ ) -> Any :
8790 """Wait until the result is identical to the given value"""
8891 return self .until (lambda left : left is right , timeout )
8992
90- def until_equals (self , right : Any , timeout : float = _DEFAULT_TIMEOUT ) -> Any :
93+ def until_equals (
94+ self ,
95+ right : Any ,
96+ timeout : float = IDOM_TESTING_DEFAULT_TIMEOUT .current ,
97+ ) -> Any :
9198 """Wait until the result is equal to the given value"""
9299 # not really sure why I need a type ignore comment here
93100 return self .until (lambda left : left == right , timeout ) # type: ignore
0 commit comments