Skip to content

Commit f2b2af1

Browse files
Fix data pipeline test
Signed-off-by: Matthias Wende <[email protected]>
1 parent 9febd66 commit f2b2af1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/microgrid/test_datapipeline.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import async_solipsism
1111
import pytest
12+
import time_machine
1213
from pytest_mock import MockerFixture
1314

1415
from frequenz.sdk.microgrid._data_pipeline import _DataPipeline
@@ -27,7 +28,10 @@ def event_loop() -> Iterator[async_solipsism.EventLoop]:
2728
loop.close()
2829

2930

30-
async def test_actors_started(mocker: MockerFixture) -> None:
31+
# loop time is advanced but not the system time
32+
async def test_actors_started(
33+
fake_time: time_machine.Coordinates, mocker: MockerFixture
34+
) -> None:
3135
"""Test that the datasourcing, resampling and power distributing actors are started."""
3236
datapipeline = _DataPipeline(
3337
resampler_config=ResamplerConfig(resampling_period=timedelta(seconds=1))
@@ -44,6 +48,7 @@ async def test_actors_started(mocker: MockerFixture) -> None:
4448
assert datapipeline._data_sourcing_actor is not None
4549
assert datapipeline._data_sourcing_actor.actor is not None
4650
await asyncio.sleep(1)
51+
fake_time.shift(timedelta(seconds=1))
4752
assert datapipeline._data_sourcing_actor.actor.is_running
4853

4954
assert datapipeline._resampling_actor is not None

0 commit comments

Comments
 (0)