File tree Expand file tree Collapse file tree 4 files changed +48
-23
lines changed
src/frequenz/sdk/microgrid Expand file tree Collapse file tree 4 files changed +48
-23
lines changed Original file line number Diff line number Diff line change @@ -495,8 +495,14 @@ async def _stop(self) -> None:
495495 if self ._resampling_actor :
496496 await self ._resampling_actor .actor .stop ()
497497 await self ._battery_power_wrapper .stop ()
498+ await self ._ev_power_wrapper .stop ()
499+ await self ._pv_power_wrapper .stop ()
498500 for pool in self ._battery_pool_reference_stores .values ():
499501 await pool .stop ()
502+ for evpool in self ._ev_charger_pool_reference_stores .values ():
503+ await evpool .stop ()
504+ for pvpool in self ._pv_pool_reference_stores .values ():
505+ await pvpool .stop ()
500506
501507
502508_DATA_PIPELINE : _DataPipeline | None = None
Original file line number Diff line number Diff line change @@ -71,19 +71,20 @@ async def mocks(mocker: MockerFixture) -> typing.AsyncIterator[Mocks]:
7171 dp = microgrid ._data_pipeline ._DATA_PIPELINE
7272 assert dp is not None
7373
74- yield Mocks (
75- mockgrid ,
76- streamer ,
77- dp ._battery_power_wrapper .status_channel .new_sender (),
78- )
79-
80- await asyncio .gather (
81- * [
82- dp ._stop (),
83- streamer .stop (),
84- mockgrid .cleanup (),
85- ]
86- )
74+ try :
75+ yield Mocks (
76+ mockgrid ,
77+ streamer ,
78+ dp ._battery_power_wrapper .status_channel .new_sender (),
79+ )
80+ finally :
81+ _ = await asyncio .gather (
82+ * [
83+ dp ._stop (),
84+ streamer .stop (),
85+ mockgrid .cleanup (),
86+ ]
87+ )
8788
8889
8990class TestBatteryPoolControl :
Original file line number Diff line number Diff line change @@ -57,11 +57,20 @@ async def mocks(mocker: MockerFixture) -> typing.AsyncIterator[_Mocks]:
5757
5858 dp = typing .cast (_DataPipeline , microgrid ._data_pipeline ._DATA_PIPELINE )
5959
60- yield _Mocks (
61- mockgrid ,
62- streamer ,
63- dp ._ev_power_wrapper .status_channel .new_sender (),
64- )
60+ try :
61+ yield _Mocks (
62+ mockgrid ,
63+ streamer ,
64+ dp ._ev_power_wrapper .status_channel .new_sender (),
65+ )
66+ finally :
67+ _ = await asyncio .gather (
68+ * [
69+ dp ._stop (),
70+ streamer .stop (),
71+ mockgrid .cleanup (),
72+ ]
73+ )
6574
6675
6776class TestEVChargerPoolControl :
Original file line number Diff line number Diff line change @@ -50,11 +50,20 @@ async def mocks(mocker: MockerFixture) -> typing.AsyncIterator[_Mocks]:
5050
5151 dp = typing .cast (_DataPipeline , microgrid ._data_pipeline ._DATA_PIPELINE )
5252
53- yield _Mocks (
54- mockgrid ,
55- streamer ,
56- dp ._pv_power_wrapper .status_channel .new_sender (),
57- )
53+ try :
54+ yield _Mocks (
55+ mockgrid ,
56+ streamer ,
57+ dp ._pv_power_wrapper .status_channel .new_sender (),
58+ )
59+ finally :
60+ _ = await asyncio .gather (
61+ * [
62+ dp ._stop (),
63+ streamer .stop (),
64+ mockgrid .cleanup (),
65+ ]
66+ )
5867
5968
6069class TestPVPoolControl :
You can’t perform that action at this time.
0 commit comments