Skip to content

Commit 94c1bb0

Browse files
authored
Integration test fixes (#737)
1 parent 85446f2 commit 94c1bb0

File tree

7 files changed

+38
-6
lines changed

7 files changed

+38
-6
lines changed

tests/integration/generated/update_bash_generation_expected_files_chrysalis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bash_files
66
# Your output will now become the new expectation.
77
# You can just move (i.e., not copy) the output since re-running this test will re-generate the output.
8+
rm -rf test_bash_generation_output/post/scripts/provenance*
89
mv test_bash_generation_output/post/scripts /lcrc/group/e3sm/public_html/zppy_test_resources/expected_bash_files
910
# Rerun test
1011
pytest tests/integration/test_bash_generation.py

tests/integration/template_update_bash_generation_expected_files.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
rm -rf #expand expected_dir#expected_bash_files
66
# Your output will now become the new expectation.
77
# You can just move (i.e., not copy) the output since re-running this test will re-generate the output.
8+
rm -rf test_bash_generation_output/post/scripts/provenance*
89
mv test_bash_generation_output/post/scripts #expand expected_dir#expected_bash_files
910
# Rerun test
1011
pytest tests/integration/test_bash_generation.py

tests/integration/test_bash_generation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
def test_bash_generation():
77
# cfg is not machine-specific
88
assert os.system("zppy -c tests/integration/test_bash_generation.cfg") == 0
9+
assert os.system("rm test_bash_generation_output/post/scripts/provenance*") == 0
910
expected_dir = get_expansions()["expected_dir"]
1011
assert (
1112
os.system(

tests/integration/test_campaign.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
def test_campaign_cryosphere():
88
assert os.system("zppy -c tests/integration/test_campaign_cryosphere.cfg") == 0
99
assert os.system("rm test_campaign_cryosphere_output/post/scripts/*.bash") == 0
10+
assert os.system("rm test_campaign_cryosphere_output/post/scripts/provenance*") == 0
1011
expected_dir = get_expansions()["expected_dir"]
1112
assert (
1213
os.system(
@@ -26,6 +27,12 @@ def test_campaign_cryosphere_override():
2627
os.system("rm test_campaign_cryosphere_override_output/post/scripts/*.bash")
2728
== 0
2829
)
30+
assert (
31+
os.system(
32+
"rm test_campaign_cryosphere_override_output/post/scripts/provenance*"
33+
)
34+
== 0
35+
)
2936
expected_dir = get_expansions()["expected_dir"]
3037
assert (
3138
os.system(
@@ -39,6 +46,9 @@ def test_campaign_cryosphere_override():
3946
def test_campaign_high_res_v1():
4047
assert os.system("zppy -c tests/integration/test_campaign_high_res_v1.cfg") == 0
4148
assert os.system("rm test_campaign_high_res_v1_output/post/scripts/*.bash") == 0
49+
assert (
50+
os.system("rm test_campaign_high_res_v1_output/post/scripts/provenance*") == 0
51+
)
4252
expected_dir = get_expansions()["expected_dir"]
4353
assert (
4454
os.system(
@@ -52,6 +62,7 @@ def test_campaign_high_res_v1():
5262
def test_campaign_none():
5363
assert os.system("zppy -c tests/integration/test_campaign_none.cfg") == 0
5464
assert os.system("rm test_campaign_none_output/post/scripts/*.bash") == 0
65+
assert os.system("rm test_campaign_none_output/post/scripts/provenance*") == 0
5566
expected_dir = get_expansions()["expected_dir"]
5667
assert (
5768
os.system(
@@ -65,6 +76,9 @@ def test_campaign_none():
6576
def test_campaign_water_cycle():
6677
assert os.system("zppy -c tests/integration/test_campaign_water_cycle.cfg") == 0
6778
assert os.system("rm test_campaign_water_cycle_output/post/scripts/*.bash") == 0
79+
assert (
80+
os.system("rm test_campaign_water_cycle_output/post/scripts/provenance*") == 0
81+
)
6882
expected_dir = get_expansions()["expected_dir"]
6983
assert (
7084
os.system(
@@ -84,6 +98,12 @@ def test_campaign_water_cycle_override():
8498
os.system("rm test_campaign_water_cycle_override_output/post/scripts/*.bash")
8599
== 0
86100
)
101+
assert (
102+
os.system(
103+
"rm test_campaign_water_cycle_override_output/post/scripts/provenance*"
104+
)
105+
== 0
106+
)
87107
expected_dir = get_expansions()["expected_dir"]
88108
assert (
89109
os.system(

tests/integration/test_defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def test_defaults():
77
# cfg is not machine-specific
88
assert os.system("zppy -c tests/integration/test_defaults.cfg") == 0
99
assert os.system("rm test_defaults_output/post/scripts/*.bash") == 0
10+
assert os.system("rm test_defaults_output/post/scripts/provenance*") == 0
1011
assert (
1112
os.system(
1213
"rm -rf test_defaults_output/post/scripts/global_time_series_0001-0020_dir"

tests/integration/test_images.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,16 @@ def test_images():
5454
if "weekly_bundles" in expansions["cfgs_to_run"]:
5555
# No mpas_analysis
5656
if "mpas_analysis" in expansions["tasks_to_run"]:
57-
tasks_to_run_copy = tasks_to_run.copy()
58-
tasks_to_run_copy.remove("mpas_analysis")
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
5961
set_up_and_run_image_checker(
6062
"bundles",
6163
V3_CASE_NAME,
6264
expansions,
6365
diff_dir_suffix,
64-
tasks_to_run_copy,
66+
tasks_to_run_modified,
6567
test_results_dict,
6668
)
6769

@@ -90,14 +92,16 @@ def test_images():
9092
if "weekly_legacy_3.0.0_bundles" in expansions["cfgs_to_run"]:
9193
# No mpas_analysis
9294
if "mpas_analysis" in expansions["tasks_to_run"]:
93-
tasks_to_run_copy = tasks_to_run.copy()
94-
tasks_to_run_copy.remove("mpas_analysis")
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
9599
set_up_and_run_image_checker(
96100
"legacy_3.0.0_bundles",
97101
V3_CASE_NAME,
98102
expansions,
99103
diff_dir_suffix,
100-
tasks_to_run_copy,
104+
tasks_to_run_modified,
101105
test_results_dict,
102106
)
103107
except Exception as e:

tests/integration/test_last_year.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
def test_last_year():
55
# Note that this integration test does not have any expected files in `tests.integration.utils.get_expansions()["expected_dir"]`
66
# cfg is not machine-specific
7+
# Start fresh:
8+
assert os.system("rm -rf test_last_year_output") == 0
79
assert os.system("zppy -c tests/integration/test_last_year.cfg --last-year 12") == 0
10+
# Remove files that are not deterministic:
811
assert os.system("rm test_last_year_output/post/scripts/*.settings") == 0
12+
assert os.system("rm test_last_year_output/post/scripts/provenance*") == 0
913
actual_files = sorted(os.listdir("test_last_year_output/post/scripts"))
1014
expected_files = [
1115
"climo_atm_monthly_180x360_aave_0001-0010.bash",

0 commit comments

Comments
 (0)