Skip to content

Commit

Permalink
#223 Apply pylint messages
Browse files Browse the repository at this point in the history
  • Loading branch information
singhd789 committed Nov 4, 2024
1 parent f057f2f commit 6e3307b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions fre/pp/configure_script_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def set_rose_apps(yamlfile,rose_regrid,rose_remap):
value=f'{interp_split[0]}_{interp_split[1]}.{interp_method}')

####################
def _yamlInfo(yamlfile,experiment,platform,target):
def yamlInfo(yamlfile,experiment,platform,target):
"""
Using a valid pp.yaml, the rose-app and rose-suite
configuration files are created in the cylc-src
Expand Down Expand Up @@ -200,12 +200,12 @@ def _yamlInfo(yamlfile,experiment,platform,target):
print(" " + outfile)

@click.command()
def yamlInfo(yamlfile,experiment,platform,target):
def _yamlInfo(yamlfile,experiment,platform,target):
'''
Wrapper script for calling yamlInfo - allows the decorated version
of the function to be separate from the undecorated version
'''
return _yamlInfo(yamlfile,experiment,platform,target)
return yamlInfo(yamlfile,experiment,platform,target)

# Use parseyaml function to parse created edits.yaml
if __name__ == '__main__':
Expand Down
17 changes: 10 additions & 7 deletions fre/pp/tests/test_configure_script_yaml.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
"""
Test configure_script_yaml
"""
import os
from pathlib import Path
from fre.pp import configure_script_yaml as csy

# Set what would be click options
experiment = "c96L65_am5f7b12r1_amip"
platform = "gfdl.ncrc5-intel22-classic"
target = "prod-openmp"
EXPERIMENT = "c96L65_am5f7b12r1_amip"
PLATFORM = "gfdl.ncrc5-intel22-classic"
TARGET = "prod-openmp"

# Set example yaml paths, input directory
test_dir = Path("fre/pp/tests")
test_yaml = Path(f"AM5_example/am5.yaml")
test_yaml = Path("AM5_example/am5.yaml")

def test_combinedyaml_exists():
"""
Expand All @@ -27,17 +30,17 @@ def test_configure_script():
os.environ["HOME"]=str(Path(f"{test_dir}/configure_yaml_out"))

# Set output directory
out_dir = Path(f"{os.getenv('HOME')}/cylc-src/{experiment}__{platform}__{target}")
out_dir = Path(f"{os.getenv('HOME')}/cylc-src/{EXPERIMENT}__{PLATFORM}__{TARGET}")
Path(out_dir).mkdir(parents=True,exist_ok=True)

# Define combined yaml
model_yaml = str(Path(f"{test_dir}/{test_yaml}"))

# Invoke configure_yaml_script.py
csy._yamlInfo(model_yaml,experiment,platform,target)
csy.yamlInfo(model_yaml,EXPERIMENT,PLATFORM,TARGET)

# Check for configuration creation and final combined yaml
assert all([Path(f"{out_dir}/{experiment}.yaml").exists(),
assert all([Path(f"{out_dir}/{EXPERIMENT}.yaml").exists(),
Path(f"{out_dir}/rose-suite.conf").exists(),
Path(f"{out_dir}/app/regrid-xy/rose-app.conf").exists(),
Path(f"{out_dir}/app/remap-pp-components/rose-app.conf").exists()])

0 comments on commit 6e3307b

Please sign in to comment.