Skip to content

Commit

Permalink
unfinished update to test path #222
Browse files Browse the repository at this point in the history
  • Loading branch information
Avery Kiihne authored and Avery Kiihne committed Oct 30, 2024
1 parent c7a06ac commit 2e2dcc3
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions fre/make/tests/null_example/test_checkout_null_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,41 @@
from pathlib import Path
from fre.pp import configure_script_yaml as csy
from click.testing import CliRunner

# Set what would be click options
experiment = "c96L65_am5f7b12r1_amip"
platform = "gfdl.ncrc5-intel22-classic"
target = "prod-openmp"
import subprocess
from fre.make import createCheckout

# Set example yaml paths, input directory
CWD = Path.cwd()
test_dir = Path("fre/make/tests/null_example")
test_yaml = Path(f"null_model.yaml")

#set platform and target
platform = "ncrc5.intel"
target = "debug"
yamlfile = "null_model.yaml"

# Set home for ~/cylc-src location in script
os.environ["HOME"]=str(Path(f"{CWD}/{test_dir}/configure_yaml_out"))

#run checkout command
runner = CliRunner()
result = runner.invoke(fre.fre, args=["make","create-checkout","-y","null_model.yaml","-p","ncrc5.intel","-t","debug"])

# Set output directory
out_dir = Path(f"{os.getenv('HOME'/fremake_canopy/test/null_model_full/src)}")
Path(out_dir).mkdir(parents=True,exist_ok=True)
def test_checkout_script_exists():
"""
Make sure checkout file exists
"""
assert Path(f"/ncrc/home2/Avery.Kiihne/fremake_canopy/test/null_model_full/src/checkout.sh").exists()
def test_combined_yaml_exists():
result = runner.invoke(fre.fre, args=["make","create-checkout","-y","null_model.yaml","-p","ncrc5.intel","-t","debug"])
#createCheckout.checkout_create(["null_model.yaml","ncrc5.intel","debug"])
assert Path(f"{out_dir}/checkout.sh").exists()

def test_checkout_execute():
"""
Make sure combined yaml created
check if --execute option works
"""
assert Path(f"{CWD}/{test_dir}/combined-null_model.yaml").exists()
subprocess.run(["rm","-rf","/ncrc/home2/Avery.Kiihne/fremake_canopy/test/null_model_full/src/"])
result = runner.invoke(fre.fre, args=["make","create-checkout","-y","null_model.yaml","-p","ncrc5.intel","-t","debug","--execute"])
assert (result.exit_code == 0)

0 comments on commit 2e2dcc3

Please sign in to comment.