Skip to content

Commit

Permalink
Add run_tower system tests of --setup-only.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Feb 14, 2025
1 parent d7c058b commit 1a95351
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions python/ctsm/test/test_sys_run_tower.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,57 @@ def test_xmlchange_plumber(self):
print(f"CCSM_CO2_PPMV = {value}")
self.assertTrue(int(value) == 1987)

def test_setup_only_neon(self):
"""
This test checks that the --setup-only argument is obeyed for NEON sites
"""

# run the run_tower tool
site_name = "BART"
sys.argv = [
os.path.join(path_to_ctsm_root(), "tools", "site_and_regional", "run_tower"),
"--neon-sites",
site_name,
"--setup-only",
"--experiment",
"TEST",
"--output-root",
self._tempdir,
]
print(sys.argv)
main("")

# make sure that build didn't happen: this dir should be empty
case_dir = os.path.join(self._tempdir, site_name)
build_dir_to_check = os.path.join(case_dir, "bld", "cpl", "obj")
self.assertTrue(os.path.exists(build_dir_to_check))
self.assertTrue(len(os.listdir(build_dir_to_check)) == 0)

def test_setup_only_plumber(self):
"""
This test checks that the --setup-only argument is obeyed for PLUMBER sites
"""

# run the run_tower tool for plumber site
site_name = "AR-SLu"
sys.argv = [
os.path.join(path_to_ctsm_root(), "tools", "site_and_regional", "run_tower"),
"--plumber-sites",
site_name,
"--setup-only",
"--experiment",
"TEST",
"--output-root",
self._tempdir,
]
main("")

# make sure that build didn't happen: this dir should be empty
case_dir = os.path.join(self._tempdir, site_name)
build_dir_to_check = os.path.join(case_dir, "bld", "cpl", "obj")
self.assertTrue(os.path.exists(build_dir_to_check))
self.assertTrue(len(os.listdir(build_dir_to_check)) == 0)


if __name__ == "__main__":
unit_testing.setup_for_tests()
Expand Down

0 comments on commit 1a95351

Please sign in to comment.