-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc5f0be
commit 2078d23
Showing
1 changed file
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,44 @@ | ||
#tests for the create-checkout step of fre-make, for null_model.yaml | ||
import os | ||
from fre import fre | ||
from pathlib import Path | ||
from fre.pp import configure_script_yaml as csy | ||
from click.testing import CliRunner | ||
import os | ||
import subprocess | ||
from fre.make import createCheckout | ||
|
||
# Set example yaml paths, input directory | ||
test_dir = Path("fre/make/tests/null_example") | ||
yamlfile = Path(f"{test_dir}/null_model.yaml") | ||
TEST_DIR = Path("fre/make/tests") | ||
YAMLFILE = Path(f"{TEST_DIR}/null_example/null_model.yaml") | ||
|
||
#set platform and target | ||
platform = "ncrc5.intel" | ||
target = "debug" | ||
PLATFORM = "ncrc5.intel" | ||
TARGET = "debug" | ||
|
||
#set output directory | ||
#out_dir = Path(f"fre/make/tests/null_example/fre_make_out") | ||
#Path(out_dir).mkdir(parents=True,exist_ok=True) | ||
|
||
# Set home for ~/cylc-src location in script | ||
#os.environ["HOME"]=str(Path(f"{out_dir}")) | ||
HOME_DIR = os.environ["HOME"] | ||
OUT = f"{TEST_DIR}/checkout_out" | ||
def_home = str(os.environ["HOME"]) | ||
os.environ["HOME"]=OUT#str(Path(OUT)) | ||
|
||
#run checkout command | ||
runner = CliRunner() | ||
|
||
def test_checkout_script_exists(): | ||
""" | ||
Make sure checkout file exists | ||
""" | ||
result = runner.invoke(fre.fre, args=["make","create-checkout","-y",yamlfile,"-p",platform,"-t",target]) | ||
#createCheckout.checkout_create(["null_model.yaml","ncrc5.intel","debug"]) | ||
result = createCheckout.checkout_create(YAMLFILE,PLATFORM,TARGET,no_parallel_checkout=False, jobs=False, verbose=False, execute=False) | ||
assert result.exit_code == 0 | ||
assert Path(f"{HOME_DIR}/fremake_canopy/test/null_model_full/src/checkout.sh").exists() | ||
|
||
1,1 Top | ||
def test_checkout_execute(): | ||
""" | ||
check if --execute option works | ||
""" | ||
#subprocess.run(["rm","-rf",f"{out_dir}"]) | ||
subprocess.run(["rm","-rf"]) | ||
result = runner.invoke(fre.fre, args=["make","create-checkout","-y",yamlfile,"-p",platform,"-t",target,"--execute"]) | ||
result = createCheckout.checkout_create(YAMLFILE,PLATFORM,TARGET,no_parallel_checkout=False, jobs=False, verbose=False, execute=False) | ||
assert (result.exit_code == 0) | ||
|
||
48,0-1 Bot |