@@ -1216,14 +1216,18 @@ async def test_service_call_params(hass):
1216
1216
"""Test that hass params get set properly on service calls."""
1217
1217
with patch .object (hass .services , "async_call" ) as call , patch .object (
1218
1218
Function , "service_has_service" , return_value = True
1219
+ ), patch .object (
1220
+ hass .services ,
1221
+ "supports_response" ,
1222
+ return_value = "none" ,
1219
1223
):
1220
1224
Function .init (hass )
1221
1225
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"
1223
1227
)
1224
1228
assert call .called
1225
1229
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 }
1227
1231
call .reset_mock ()
1228
1232
1229
1233
await Function .service_call (
@@ -1234,12 +1238,10 @@ async def test_service_call_params(hass):
1234
1238
assert call .call_args [1 ] == {"context" : Context (id = "test" ), "blocking" : False }
1235
1239
call .reset_mock ()
1236
1240
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" )
1240
1242
assert call .called
1241
1243
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 }
1243
1245
call .reset_mock ()
1244
1246
1245
1247
await Function .get ("test.test" )(
@@ -1285,20 +1287,19 @@ def func_startup():
1285
1287
pyscript.done = [seq_num, pyscript.var1]
1286
1288
1287
1289
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)
1290
1291
pyscript.done = [seq_num, pyscript.var1]
1291
1292
1292
- task.cancel(long_sleep_id)
1293
1293
seq_num += 1
1294
1294
pyscript.done = [seq_num]
1295
1295
1296
1296
@service
1297
- def long_sleep ():
1297
+ def short_sleep ():
1298
1298
global long_sleep_id
1299
1299
1300
1300
long_sleep_id = task.current_task()
1301
- task.sleep(10000)
1301
+ task.sleep(0.0001)
1302
+ pyscript.var1 = int(pyscript.var1) + 1
1302
1303
1303
1304
@service
1304
1305
def service1():
0 commit comments