From 6e3307ba312309d9cba405e404c6549e5b0a7082 Mon Sep 17 00:00:00 2001 From: Dana Singh Date: Mon, 4 Nov 2024 13:58:21 -0500 Subject: [PATCH] #223 Apply pylint messages --- fre/pp/configure_script_yaml.py | 6 +++--- fre/pp/tests/test_configure_script_yaml.py | 17 ++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/fre/pp/configure_script_yaml.py b/fre/pp/configure_script_yaml.py index 443d6e00..b782e3de 100644 --- a/fre/pp/configure_script_yaml.py +++ b/fre/pp/configure_script_yaml.py @@ -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 @@ -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__': diff --git a/fre/pp/tests/test_configure_script_yaml.py b/fre/pp/tests/test_configure_script_yaml.py index fbd17796..eaf1fc2e 100644 --- a/fre/pp/tests/test_configure_script_yaml.py +++ b/fre/pp/tests/test_configure_script_yaml.py @@ -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(): """ @@ -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()])