Skip to content

Commit d62c897

Browse files
committed
Fix mistake with timeslice fixture
1 parent 2761937 commit d62c897

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

tests/conftest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from muse.__main__ import patched_broadcast_compat_data
2121
from muse.agents import Agent
2222
from muse.commodities import CommodityUsage
23-
from muse.timeslices import TIMESLICE, setup_module
23+
from muse.timeslices import TIMESLICE, read_timeslices, setup_module
2424

2525
# Constants
2626
RANDOM_SEED = 123
@@ -192,11 +192,15 @@ def compare_dirs(
192192
def default_timeslice_globals():
193193
"""Set up default timeslice configuration."""
194194
setup_module(DEFAULT_TIMESLICES)
195+
return DEFAULT_TIMESLICES
195196

196197

197198
@fixture
198-
def timeslice(default_timeslice_globals) -> Dataset:
199+
def timeslice(default_timeslice_globals) -> DataArray:
199200
"""Get the default timeslice dataset."""
201+
if TIMESLICE is None:
202+
# If TIMESLICE is not set, create it from the default timeslices
203+
return read_timeslices(default_timeslice_globals)
200204
return TIMESLICE
201205

202206

@@ -387,7 +391,7 @@ def technologies(coords: Mapping) -> Dataset:
387391

388392

389393
@fixture
390-
def agent_market(coords: Mapping, timeslice: Dataset) -> Dataset:
394+
def agent_market(coords: Mapping, timeslice: DataArray) -> Dataset:
391395
"""Generate market data for agent testing.
392396
393397
Args:
@@ -419,7 +423,7 @@ def agent_market(coords: Mapping, timeslice: Dataset) -> Dataset:
419423

420424

421425
@fixture
422-
def market(coords: Mapping, timeslice: Dataset) -> Dataset:
426+
def market(coords: Mapping, timeslice: DataArray) -> Dataset:
423427
"""Generate market data for testing.
424428
425429
Args:
@@ -578,7 +582,7 @@ def _stock(coords: Mapping, technologies: Dataset) -> Dataset:
578582

579583

580584
@fixture
581-
def demand_share(coords: Mapping, timeslice: Dataset) -> DataArray:
585+
def demand_share(coords: Mapping, timeslice: DataArray) -> DataArray:
582586
"""Generate demand share data for testing.
583587
584588
Args:

0 commit comments

Comments
 (0)