diff --git a/esmvalcore/_recipe_checks.py b/esmvalcore/_recipe_checks.py index 1133a36639..89e27bfe1e 100644 --- a/esmvalcore/_recipe_checks.py +++ b/esmvalcore/_recipe_checks.py @@ -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): diff --git a/tests/integration/test_recipe_checks.py b/tests/integration/test_recipe_checks.py index 5cec9b2abf..1a4f0e290c 100644 --- a/tests/integration/test_recipe_checks.py +++ b/tests/integration/test_recipe_checks.py @@ -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]])), ]