Skip to content

Commit

Permalink
Sort missing years in "No input data available for years" message (#1225
Browse files Browse the repository at this point in the history
)

* added a sorted print statement.

* Update esmvalcore/_recipe_checks.py

* Update esmvalcore/_recipe_checks.py

Co-authored-by: Javier Vegas-Regidor <[email protected]>

* Fix failing test

Co-authored-by: Javier Vegas-Regidor <[email protected]>
  • Loading branch information
ledm and Javier Vegas-Regidor authored Jul 14, 2021
1 parent 62b4c75 commit 2a0bb11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion esmvalcore/_recipe_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def data_availability(input_files, var, dirnames, filenames):
if missing_years:
raise RecipeError(
"No input data available for years {} in files {}".format(
", ".join(str(year) for year in missing_years), input_files))
", ".join(str(year) for year in sorted(missing_years)),
input_files))


def tasks_valid(tasks):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_recipe_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
(FILES[:-1], dict(VAR), ERR_RANGE.format('2025', FILES[:-1])),
(FILES[:-2], dict(VAR), ERR_RANGE.format('2024, 2025', FILES[:-2])),
([FILES[1]] + [FILES[3]], dict(VAR),
ERR_RANGE.format('2024, 2025, 2020, 2022', [FILES[1]] + [FILES[3]])),
ERR_RANGE.format('2020, 2022, 2024, 2025', [FILES[1]] + [FILES[3]])),
]


Expand Down

0 comments on commit 2a0bb11

Please sign in to comment.