Skip to content

Commit 3e256dc

Browse files
moved shell script that performs the export to the test code and added a check for the users value not in the parm
1 parent c1adce8 commit 3e256dc

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

ci/scripts/tests/run_setup_xml.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

ci/scripts/tests/test_setup.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
RUNDIR = os.path.join(_here, 'testdata/RUNDIR')
88
pslot = "C48_ATM"
99
account = "fv3-cpu"
10+
foobar = "foobar"
1011

1112

1213
def test_setup_expt():
@@ -25,6 +26,20 @@ def test_setup_expt():
2526

2627
def test_setup_xml():
2728

29+
script_content = '''#!/usr/bin/env bash
30+
31+
output=f"testdata/output.txt"
32+
33+
rm -f "${output}"
34+
export ACCOUNT={foobar}
35+
echo "ACCOUNT=${ACCOUNT}" > "${output}"
36+
37+
../../../workflow/setup_xml.py "${1}"
38+
'''
39+
with open('run_setup_xml.sh', 'w') as file:
40+
file.write(script_content)
41+
os.chmod('run_setup_xml.sh', 0o755)
42+
2843
setup_xml_script = Executable(os.path.join(HOMEgfs, "ci", "scripts", "tests", "run_setup_xml.sh"))
2944
setup_xml_script.add_default_arg(f"{RUNDIR}/{pslot}")
3045
setup_xml_script()
@@ -33,9 +48,11 @@ def test_setup_xml():
3348
cfg = Configuration(f"{RUNDIR}/{pslot}")
3449
base = cfg.parse_config('config.base')
3550
assert base.ACCOUNT == account
51+
assert foobar not in base.values()
3652

3753
with open(f"{RUNDIR}/{pslot}/{pslot}.xml", 'r') as file:
3854
contents = file.read()
39-
assert contents.count(account) == 7
40-
55+
assert contents.count(account) > 5
56+
57+
os.remove('run_setup_xml.sh')
4158
rmtree(RUNDIR)

0 commit comments

Comments
 (0)