Skip to content

Commit

Permalink
runconfig_get_component_list test
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Aug 30, 2024
1 parent 673b043 commit 5facb60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion payu/models/cesm_cmeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _setup_checks(self):
case "netcdf":
break
case "netcdf4p" | "pnetcdf":
if self.runconfig.get(io_section, "pio_async_interface") == ".false." :
if self.runconfig.get(io_section, "pio_async_interface") == ".false.":
niotasks = int(self.runconfig.get(io_section, "pio_numiotasks"))
iostride = int(self.runconfig.get(io_section, "pio_stride"))
if (int(ioroot) + (niotasks-1)*iostride) > npes:
Expand Down
10 changes: 10 additions & 0 deletions test/models/test_cesm_cmeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ def test_runconfig_get_default():

assert runconfig.get("DOES_NOT_EXIST", "DOES_NOT_EXIST", value="default") == "default"

def test_runconfig_get_component_list():
"""Test getting component_list from a nuopc.runconfig file"""
COMP_LIST = ['MED', 'ATM', 'ICE', 'OCN', 'ROF']

runconfig_path = os.path.join('test', 'resources', 'nuopc.runconfig')
runconfig = Runconfig(runconfig_path)

assert runconfig.get_component_list() == COMP_LIST

@pytest.mark.parametrize(
"section, variable, new_variable",
[
Expand Down Expand Up @@ -75,3 +84,4 @@ def test_runconfig_set_write_get():
assert runconfig.get("CLOCK_attributes", "restart_n") == "2"

os.remove(runconfig_path_tmp)

0 comments on commit 5facb60

Please sign in to comment.