@@ -1216,14 +1216,18 @@ async def test_service_call_params(hass):
12161216 """Test that hass params get set properly on service calls."""
12171217 with patch .object (hass .services , "async_call" ) as call , patch .object (
12181218 Function , "service_has_service" , return_value = True
1219+ ), patch .object (
1220+ hass .services ,
1221+ "supports_response" ,
1222+ return_value = "none" ,
12191223 ):
12201224 Function .init (hass )
12211225 await Function .service_call (
1222- "test" , "test" , context = Context (id = "test" ), blocking = True , limit = 1 , other_service_data = "test"
1226+ "test" , "test" , context = Context (id = "test" ), blocking = True , other_service_data = "test"
12231227 )
12241228 assert call .called
12251229 assert call .call_args [0 ] == ("test" , "test" , {"other_service_data" : "test" })
1226- assert call .call_args [1 ] == {"context" : Context (id = "test" ), "blocking" : True , "limit" : 1 }
1230+ assert call .call_args [1 ] == {"context" : Context (id = "test" ), "blocking" : True }
12271231 call .reset_mock ()
12281232
12291233 await Function .service_call (
@@ -1234,12 +1238,10 @@ async def test_service_call_params(hass):
12341238 assert call .call_args [1 ] == {"context" : Context (id = "test" ), "blocking" : False }
12351239 call .reset_mock ()
12361240
1237- await Function .get ("test.test" )(
1238- context = Context (id = "test" ), blocking = True , limit = 1 , other_service_data = "test"
1239- )
1241+ await Function .get ("test.test" )(context = Context (id = "test" ), blocking = True , other_service_data = "test" )
12401242 assert call .called
12411243 assert call .call_args [0 ] == ("test" , "test" , {"other_service_data" : "test" })
1242- assert call .call_args [1 ] == {"context" : Context (id = "test" ), "blocking" : True , "limit" : 1 }
1244+ assert call .call_args [1 ] == {"context" : Context (id = "test" ), "blocking" : True }
12431245 call .reset_mock ()
12441246
12451247 await Function .get ("test.test" )(
@@ -1285,20 +1287,19 @@ def func_startup():
12851287 pyscript.done = [seq_num, pyscript.var1]
12861288
12871289 seq_num += 1
1288- pyscript.var1 = int(pyscript.var1) + 1
1289- service.call("pyscript", "long_sleep", blocking=True, limit=1e-6)
1290+ service.call("pyscript", "short_sleep", blocking=True)
12901291 pyscript.done = [seq_num, pyscript.var1]
12911292
1292- task.cancel(long_sleep_id)
12931293 seq_num += 1
12941294 pyscript.done = [seq_num]
12951295
12961296@service
1297- def long_sleep ():
1297+ def short_sleep ():
12981298 global long_sleep_id
12991299
13001300 long_sleep_id = task.current_task()
1301- task.sleep(10000)
1301+ task.sleep(0.0001)
1302+ pyscript.var1 = int(pyscript.var1) + 1
13021303
13031304@service
13041305def service1():
0 commit comments