Skip to content

Commit bd793a9

Browse files
committed
fixing --test (changing only the behaviour of creating datasets with --test)
1 parent 7e03f10 commit bd793a9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/anemoi/datasets/create/config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,14 @@ def _prepare_serialisation(o):
215215
def set_to_test_mode(cfg):
216216
NUMBER_OF_DATES = 4
217217

218-
dates = cfg["dates"]
219218
LOG.warning(f"Running in test mode. Changing the list of dates to use only {NUMBER_OF_DATES}.")
220219
groups = Groups(**LoadersConfig(cfg).dates)
221220

222-
dates = groups.dates
221+
dates = groups.provider.values
223222
cfg["dates"] = dict(
224223
start=dates[0],
225224
end=dates[NUMBER_OF_DATES - 1],
226-
frequency=dates.frequency,
225+
frequency=groups.provider.frequency,
227226
group_by=NUMBER_OF_DATES,
228227
)
229228

tests/create/test_create.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,13 @@ def compare(self):
253253

254254
@pytest.mark.parametrize("name", NAMES)
255255
@pytest.mark.skipif(not extensive_tests, reason="Skipping to run the test faster")
256+
@pytest.mark.parametrize("is_test", [False, True])
256257
@mockup_from_source
257-
def test_run(name):
258+
def test_run(name, is_test=False):
258259
config = os.path.join(HERE, name + ".yaml")
259260
output = os.path.join(HERE, name + ".zarr")
260261

261-
creator_factory("init", config=config, path=output, overwrite=True).run()
262+
creator_factory("init", config=config, path=output, overwrite=True, test=is_test).run()
262263
creator_factory("load", path=output).run()
263264
creator_factory("finalise", path=output).run()
264265
creator_factory("patch", path=output).run()

0 commit comments

Comments
 (0)