@@ -266,7 +266,8 @@ async def test_power_distributor_one_user(
266
266
await client_handle .send (request )
267
267
268
268
done , pending = await asyncio .wait (
269
- [client_handle .receive ()], timeout = SAFETY_TIMEOUT
269
+ [asyncio .create_task (client_handle .receive ())],
270
+ timeout = SAFETY_TIMEOUT ,
270
271
)
271
272
await distributor ._stop () # type: ignore # pylint: disable=no-member
272
273
@@ -337,7 +338,11 @@ async def test_power_distributor_two_users(
337
338
await asyncio .gather (* [task1 , task2 ])
338
339
339
340
done , pending = await asyncio .wait (
340
- [user1_handle .receive (), user2_handle .receive ()], timeout = SAFETY_TIMEOUT
341
+ [
342
+ asyncio .create_task (user1_handle .receive ()),
343
+ asyncio .create_task (user2_handle .receive ()),
344
+ ],
345
+ timeout = SAFETY_TIMEOUT ,
341
346
)
342
347
await distributor ._stop () # type: ignore # pylint: disable=no-member
343
348
@@ -394,7 +399,8 @@ async def test_power_distributor_invalid_battery_id(self) -> None:
394
399
await user1_handle .send (request )
395
400
396
401
done , _ = await asyncio .wait (
397
- [user1_handle .receive ()], timeout = SAFETY_TIMEOUT
402
+ [asyncio .create_task (user1_handle .receive ())],
403
+ timeout = SAFETY_TIMEOUT ,
398
404
)
399
405
await distributor ._stop () # type: ignore # pylint: disable=no-member
400
406
@@ -476,9 +482,9 @@ async def test_power_distributor_overlapping_batteries(self) -> None:
476
482
477
483
done , _ = await asyncio .wait (
478
484
[
479
- user1_handle .receive (),
480
- user2_handle .receive (),
481
- user3_handle .receive (),
485
+ asyncio . create_task ( user1_handle .receive () ),
486
+ asyncio . create_task ( user2_handle .receive () ),
487
+ asyncio . create_task ( user3_handle .receive () ),
482
488
],
483
489
timeout = SAFETY_TIMEOUT ,
484
490
)
@@ -552,7 +558,8 @@ async def test_power_distributor_one_user_adjust_power_consume(
552
558
await user1_handle .send (request )
553
559
554
560
done , pending = await asyncio .wait (
555
- [user1_handle .receive ()], timeout = SAFETY_TIMEOUT
561
+ [asyncio .create_task (user1_handle .receive ())],
562
+ timeout = SAFETY_TIMEOUT ,
556
563
)
557
564
await distributor ._stop () # type: ignore # pylint: disable=no-member
558
565
@@ -618,7 +625,8 @@ async def test_power_distributor_one_user_adjust_power_supply(
618
625
await user1_handle .send (request )
619
626
620
627
done , pending = await asyncio .wait (
621
- [user1_handle .receive ()], timeout = SAFETY_TIMEOUT
628
+ [asyncio .create_task (user1_handle .receive ())],
629
+ timeout = SAFETY_TIMEOUT ,
622
630
)
623
631
await distributor ._stop () # type: ignore # pylint: disable=no-member
624
632
@@ -684,7 +692,8 @@ async def test_power_distributor_one_user_adjust_power_success(
684
692
await user1_handle .send (request )
685
693
686
694
done , pending = await asyncio .wait (
687
- [user1_handle .receive ()], timeout = SAFETY_TIMEOUT
695
+ [asyncio .create_task (user1_handle .receive ())],
696
+ timeout = SAFETY_TIMEOUT ,
688
697
)
689
698
await distributor ._stop () # type: ignore # pylint: disable=no-member
690
699
@@ -743,7 +752,8 @@ async def test_not_all_batteries_are_working(
743
752
await client_handle .send (request )
744
753
745
754
done , pending = await asyncio .wait (
746
- [client_handle .receive ()], timeout = SAFETY_TIMEOUT
755
+ [asyncio .create_task (client_handle .receive ())],
756
+ timeout = SAFETY_TIMEOUT ,
747
757
)
748
758
await distributor ._stop () # type: ignore # pylint: disable=no-member
749
759
0 commit comments