Skip to content

Commit d13ff7d

Browse files
committed
script matlab python
1 parent dde21d2 commit d13ff7d

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

scripts/test_matlab_versions.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,42 @@
44

55
# these are HPC system specific
66
version_keys = [
7-
"2025b",
8-
"2025a",
9-
"2024b",
10-
"2024a",
11-
"2023b",
12-
"2023a",
13-
"2022b",
14-
"2022a",
15-
"2021b",
16-
"2021a",
17-
"2020b",
18-
"2020a",
19-
"2019b",
20-
"2019a",
21-
"2018b",
22-
"2018a",
23-
"2017b",
24-
"2017a",
7+
"2025b",
8+
"2025a",
9+
"2024b",
10+
"2024a",
11+
"2023b",
12+
"2023a",
13+
"2022b",
14+
"2022a",
15+
"2021b",
16+
"2021a",
17+
"2020b",
18+
"2020a",
19+
"2019b",
20+
"2019a",
21+
"2018b",
22+
"2018a",
23+
"2017b",
24+
"2017a",
2525
]
2626

2727

28-
@pytest.mark.skipif(not platform.system() == "Linux")
28+
@pytest.mark.skipif(not platform.system() == "Linux", reason="HPC only")
2929
@pytest.mark.parametrize("version", version_keys)
3030
def test_matlab_version(version):
31-
print(f"Testing MATLAB version: {version}")
3231

33-
ret = subprocess.run(["module", "load", f"matlab/{version}"])
32+
ret = subprocess.run(f"module is-avail matlab/{version}", shell=True, capture_output=True, text=True)
3433
if ret.returncode != 0:
35-
pytest.skip(f"MATLAB version {version} not available")
34+
pytest.skip(f"MATLAB version {version} not available {ret.stderr}")
35+
36+
lcmd = f"module load matlab/{version} && "
3637

3738
if version >= "2022b":
38-
cmd = ["matlab", "-batch", "buildtool test"]
39+
cmd = lcmd + "matlab -batch 'buildtool test'"
3940
elif version >= "2019a":
40-
cmd = ["matlab", "-batch", "test_main"]
41+
cmd = lcmd + "matlab -batch test_main"
4142
else:
42-
cmd = ["matlab", "-r", "test_main; exit"]
43+
cmd = lcmd + "matlab -r 'test_main; exit'"
4344

44-
subprocess.check_call(cmd)
45+
subprocess.check_call(cmd, shell=True)

0 commit comments

Comments
 (0)