-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null tests.142 #290
base: main
Are you sure you want to change the base?
Null tests.142 #290
Changes from all commits
0e13bee
413f922
c7a06ac
2e2dcc3
0ab4be6
3b78d84
2fb2724
2c0846f
34eb37e
ba1b40b
cfda9af
c295c8b
0d28382
2c41baf
3f04df9
70fb326
18def12
4f51b8b
77f1bac
f8f3c7b
fdf6bff
c7c62d7
cd651df
fe3b347
69896af
da09b07
f1824e8
33c1831
1dada88
91b82b0
1c3464c
ba54159
03bc67a
24d021b
baa9293
320e270
3fcd58c
848ecb2
d5ba986
6547d92
17b609f
b058aa5
c7c7ec2
605534e
acb276c
52b69d7
ffbdb04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#tests for the create-checkout step of fre-make, for null_model.yaml | ||
from pathlib import Path | ||
import os | ||
import subprocess | ||
from fre.make import create_checkout_script | ||
|
||
# Set example yaml paths, input directory | ||
TEST_DIR = str(Path("fre/make/tests")) | ||
YAMLFILE = str(Path(f"{TEST_DIR}/null_example/null_model.yaml")) | ||
|
||
#set platform and target | ||
PLATFORM = ["ci.gnu"] | ||
TARGET = ["debug"] | ||
|
||
#set output directory | ||
# Set home for ~/cylc-src location in script | ||
#run checkout command | ||
OUT = f"{TEST_DIR}/test_run_fremake_multitarget" | ||
os.environ["TEST_BUILD_DIR"] = OUT | ||
|
||
def test_nullyaml_exists(): | ||
""" | ||
Make sure combined yaml file exists | ||
""" | ||
assert Path(f"{YAMLFILE}").exists() | ||
|
||
def test_nullyaml_filled(): | ||
""" | ||
Make sure null.yaml is not an empty file | ||
""" | ||
sum(1 for _ in open(f'{YAMLFILE}')) > 1 | ||
|
||
def test_checkout_script_exists(): | ||
""" | ||
Make sure checkout file exists | ||
""" | ||
subprocess.run(["rm","-rf",f"{OUT}/fremake_canopy/test/null_model_full/src/checkout.sh"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of |
||
create_checkout_script.checkout_create(YAMLFILE, | ||
PLATFORM, | ||
TARGET, | ||
no_parallel_checkout = False, | ||
jobs = False, execute = False, | ||
verbose = False) | ||
#assert result.exit_code == 0 | ||
assert Path(f"{OUT}/fremake_canopy/test/null_model_full/src/checkout.sh").exists() | ||
|
||
def test_checkout_verbose(): | ||
""" | ||
check if --verbose option works | ||
""" | ||
create_checkout_script.checkout_create(YAMLFILE, | ||
PLATFORM, | ||
TARGET, | ||
no_parallel_checkout = False, | ||
jobs = False, | ||
execute = False, | ||
verbose = True) | ||
|
||
def test_checkout_execute(): | ||
""" | ||
check if --execute option works | ||
""" | ||
subprocess.run(["rm","-rf",f"{OUT}/fremake_canopy/test"]) | ||
create_checkout_script.checkout_create(YAMLFILE, | ||
PLATFORM, | ||
TARGET, | ||
no_parallel_checkout = False, | ||
jobs = 2, | ||
execute = True, | ||
verbose = False) | ||
|
||
def test_checkout_no_parallel_checkout(): | ||
""" | ||
check if --no_parallel_checkout option works | ||
""" | ||
create_checkout_script.checkout_create(YAMLFILE, | ||
PLATFORM, | ||
TARGET, | ||
no_parallel_checkout = True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll need to check that actual contents of the file here and add an assert here as well (for file creation). If the |
||
jobs = False, | ||
execute = False, | ||
verbose = False) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sorry, just noticed. I recommend changing
OUT
toOUT = f"{TEST_DIR}/checkout_out"
, or something checkout related so we know it's associated with this test. It might be checking for output files in the wrong directory here (that path was from the run-fremake test).