Skip to content

Commit 93cdf32

Browse files
authored
Update task handling in test_images (#751)
1 parent 0f24ccd commit 93cdf32

File tree

2 files changed

+43
-16
lines changed

2 files changed

+43
-16
lines changed

tests/integration/image_checker.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ def set_up_and_run_image_checker(
7676
print(f"{key}: {d[key]}")
7777
parameters: Parameters = Parameters(d)
7878
for task in task_list:
79-
if task == "pcmdi_diags":
80-
print(f"{task} hs no expected results yet, skipping.")
81-
continue
8279
test_results = check_images(parameters, task)
8380
test_results_dict[f"{cfg_specifier}_{task}"] = test_results
8481

tests/integration/test_images.py

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
V2_CASE_NAME = "v2.LR.historical_0201"
1212

1313

14+
def intersect_tasks(
15+
available_tasks: List[str], requested_tasks: List[str]
16+
) -> List[str]:
17+
return [task for task in requested_tasks if task in available_tasks]
18+
19+
1420
def test_images():
1521
# To test a different branch, set this to True, and manually set the expansions.
1622
TEST_DIFFERENT_EXPANSIONS = False
@@ -27,13 +33,20 @@ def test_images():
2733
expansions = get_expansions()
2834
diff_dir_suffix = ""
2935
test_results_dict: Dict[str, Results] = dict()
30-
tasks_to_run: List[str] = list(expansions["tasks_to_run"])
36+
requested_tasks: List[str] = list(expansions["tasks_to_run"])
3137
try:
3238
# TODO: these could be run in parallel, if easy to implement
3339

3440
# Weekly comprehensive tests
3541
print("Checking weekly cfg output")
3642
if "weekly_comprehensive_v2" in expansions["cfgs_to_run"]:
43+
available_tasks = [
44+
"e3sm_diags",
45+
"mpas_analysis",
46+
"global_time_series",
47+
"ilamb",
48+
]
49+
tasks_to_run = intersect_tasks(available_tasks, requested_tasks)
3750
set_up_and_run_image_checker(
3851
"comprehensive_v2",
3952
V2_CASE_NAME,
@@ -43,6 +56,15 @@ def test_images():
4356
test_results_dict,
4457
)
4558
if "weekly_comprehensive_v3" in expansions["cfgs_to_run"]:
59+
# Adds pcmdi_diags
60+
available_tasks = [
61+
"e3sm_diags",
62+
"mpas_analysis",
63+
"global_time_series",
64+
"ilamb",
65+
"pcmdi_diags",
66+
]
67+
tasks_to_run = intersect_tasks(available_tasks, requested_tasks)
4668
set_up_and_run_image_checker(
4769
"comprehensive_v3",
4870
V3_CASE_NAME,
@@ -53,17 +75,14 @@ def test_images():
5375
)
5476
if "weekly_bundles" in expansions["cfgs_to_run"]:
5577
# No mpas_analysis
56-
if "mpas_analysis" in expansions["tasks_to_run"]:
57-
tasks_to_run_modified = tasks_to_run.copy()
58-
tasks_to_run_modified.remove("mpas_analysis")
59-
else:
60-
tasks_to_run_modified = tasks_to_run
78+
available_tasks = ["e3sm_diags", "global_time_series", "ilamb"]
79+
tasks_to_run = intersect_tasks(available_tasks, requested_tasks)
6180
set_up_and_run_image_checker(
6281
"bundles",
6382
V3_CASE_NAME,
6483
expansions,
6584
diff_dir_suffix,
66-
tasks_to_run_modified,
85+
tasks_to_run,
6786
test_results_dict,
6887
)
6988

@@ -72,6 +91,13 @@ def test_images():
7291
# to check for backwards-compatiblity issues.
7392
print("Checking legacy cfg output")
7493
if "weekly_legacy_3.0.0_comprehensive_v2" in expansions["cfgs_to_run"]:
94+
available_tasks = [
95+
"e3sm_diags",
96+
"mpas_analysis",
97+
"global_time_series",
98+
"ilamb",
99+
]
100+
tasks_to_run = intersect_tasks(available_tasks, requested_tasks)
75101
set_up_and_run_image_checker(
76102
"legacy_3.0.0_comprehensive_v2",
77103
V2_CASE_NAME,
@@ -81,6 +107,13 @@ def test_images():
81107
test_results_dict,
82108
)
83109
if "weekly_legacy_3.0.0_comprehensive_v3" in expansions["cfgs_to_run"]:
110+
available_tasks = [
111+
"e3sm_diags",
112+
"mpas_analysis",
113+
"global_time_series",
114+
"ilamb",
115+
]
116+
tasks_to_run = intersect_tasks(available_tasks, requested_tasks)
84117
set_up_and_run_image_checker(
85118
"legacy_3.0.0_comprehensive_v3",
86119
V3_CASE_NAME,
@@ -91,17 +124,14 @@ def test_images():
91124
)
92125
if "weekly_legacy_3.0.0_bundles" in expansions["cfgs_to_run"]:
93126
# No mpas_analysis
94-
if "mpas_analysis" in expansions["tasks_to_run"]:
95-
tasks_to_run_modified = tasks_to_run.copy()
96-
tasks_to_run_modified.remove("mpas_analysis")
97-
else:
98-
tasks_to_run_modified = tasks_to_run
127+
available_tasks = ["e3sm_diags", "global_time_series", "ilamb"]
128+
tasks_to_run = intersect_tasks(available_tasks, requested_tasks)
99129
set_up_and_run_image_checker(
100130
"legacy_3.0.0_bundles",
101131
V3_CASE_NAME,
102132
expansions,
103133
diff_dir_suffix,
104-
tasks_to_run_modified,
134+
tasks_to_run,
105135
test_results_dict,
106136
)
107137
except Exception as e:

0 commit comments

Comments
 (0)