@@ -56,6 +56,7 @@ async def until(
5656 condition : Callable [[_R ], bool ],
5757 timeout : float = IDOM_TESTING_DEFAULT_TIMEOUT .current ,
5858 delay : float = _DEFAULT_POLL_DELAY ,
59+ description : str = "condition to be true" ,
5960 ) -> None :
6061 """Check that the coroutines result meets a condition within the timeout"""
6162 started_at = time .time ()
@@ -66,7 +67,7 @@ async def until(
6667 break
6768 elif (time .time () - started_at ) > timeout : # pragma: no cover
6869 raise TimeoutError (
69- f"Condition not met within { timeout } "
70+ f"Expected { description } after { timeout } "
7071 f"seconds - last value was { result !r} "
7172 )
7273
@@ -77,7 +78,12 @@ async def until_is(
7778 delay : float = _DEFAULT_POLL_DELAY ,
7879 ) -> None :
7980 """Wait until the result is identical to the given value"""
80- return await self .until (lambda left : left is right , timeout , delay )
81+ return await self .until (
82+ lambda left : left is right ,
83+ timeout ,
84+ delay ,
85+ f"value to be identical to { right !r} " ,
86+ )
8187
8288 async def until_equals (
8389 self ,
@@ -86,7 +92,12 @@ async def until_equals(
8692 delay : float = _DEFAULT_POLL_DELAY ,
8793 ) -> None :
8894 """Wait until the result is equal to the given value"""
89- return await self .until (lambda left : left == right , timeout , delay )
95+ return await self .until (
96+ lambda left : left == right ,
97+ timeout ,
98+ delay ,
99+ f"value to equal { right !r} " ,
100+ )
90101
91102
92103class HookCatcher :
0 commit comments