Skip to content

Commit

Permalink
fixing --test (changing only the behaviour of creating datasets with …
Browse files Browse the repository at this point in the history
…--test)
  • Loading branch information
floriankrb committed Nov 5, 2024
1 parent 7e03f10 commit bd793a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/anemoi/datasets/create/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,14 @@ def _prepare_serialisation(o):
def set_to_test_mode(cfg):
NUMBER_OF_DATES = 4

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

dates = groups.dates
dates = groups.provider.values
cfg["dates"] = dict(
start=dates[0],
end=dates[NUMBER_OF_DATES - 1],
frequency=dates.frequency,
frequency=groups.provider.frequency,
group_by=NUMBER_OF_DATES,
)

Expand Down
5 changes: 3 additions & 2 deletions tests/create/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,13 @@ def compare(self):

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

creator_factory("init", config=config, path=output, overwrite=True).run()
creator_factory("init", config=config, path=output, overwrite=True, test=is_test).run()
creator_factory("load", path=output).run()
creator_factory("finalise", path=output).run()
creator_factory("patch", path=output).run()
Expand Down

0 comments on commit bd793a9

Please sign in to comment.