Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaganKing committed Aug 23, 2024
1 parent a7462b1 commit 24897b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions python/ctsm/test/test_sys_run_tower.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys

from ctsm import unit_testing
from python.ctsm.site_and_regional.run_tower import main
from ctsm.site_and_regional.run_tower import main
from ctsm.path_utils import path_to_ctsm_root

# Allow test names that pylint doesn't like; otherwise hard to make them
Expand All @@ -21,7 +21,14 @@


class TestSysRunTower(unittest.TestCase):
"""System tests for run_tower"""
"""
System tests for run_tower
TODO: Would also be useful to test the following items:
Ensure the log files are working as expected?
Test use of base case root.
Test for using prism
"""

def setUp(self):
"""
Expand All @@ -46,19 +53,23 @@ def test_one_site(self):
"""

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

# assert that BART directories were created during setup
self.assertTrue("BART" in glob.glob(self._tempdir + "/BART*")[0])
print(glob.glob(self._tempdir))

def test_ad_site(self):
"""
Expand All @@ -72,21 +83,16 @@ def test_ad_site(self):
"--neon-sites",
"ABBY",
"--setup-only",
"--run-type",
"ad",
"--output-root",
"--run-type ad",
self._tempdir,
]
main("")

# assert that ABBY directories were created during setup
self.assertTrue("ABBY" in glob.glob(self._tempdir + "/ABBY*")[0])

# TODO: Would also be useful to test the following items:
# It might be good to ensure the log files are working as expected?
# Test running transient, ad and post ad cases.
# Test use of base case root.
# Test for using prism?

def test_plumber_site(self):
"""
This test specifies a site to run a default plumber AD case with
Expand All @@ -99,8 +105,9 @@ def test_plumber_site(self):
"--plumber-sites",
"AR-SLu",
"--setup-only",
"--experiment",
"TEST",
"--output-root",
"--experiment TEST",
self._tempdir,
]
main("")
Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/test/test_unit_tower_arg_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_plumber(self):
]
description = ""
cesmroot = path_to_ctsm_root()

valid_neon_sites = glob.glob(
os.path.join(cesmroot, "cime_config", "usermods_dirs", "NEON", "[!Fd]*")
)
Expand Down

0 comments on commit 24897b3

Please sign in to comment.