STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_check_config_load.py
Go to the documentation of this file.
1"""check_config_load.py checks any config it is handed, of any injector type.
2
3It read '/Users/carlton/Downloads/Layer 3 Optimized Config.yaml' and printed a pintle-only field, so
4on any other machine it died with FileNotFoundError and on an impinging design it checked nothing.
5"""
6
7from __future__ import annotations
8
9import importlib.util
10from pathlib import Path
11
12ROOT = Path(__file__).resolve().parents[1]
13
14
15def _script():
16 spec = importlib.util.spec_from_file_location("check_config_load", ROOT / "check_config_load.py")
17 mod = importlib.util.module_from_spec(spec)
18 spec.loader.exec_module(mod)
19 return mod
20
21
23 rc = _script().main([str(ROOT / "configs" / "canonical" / "impinging.yaml"),
24 str(ROOT / "configs" / "canonical" / "pintle.yaml")])
25 out = capsys.readouterr().out
26 assert rc == 0, out
27 assert "injector impinging" in out and "injector pintle" in out
28
29
31 bad = tmp_path / "bad.yaml"
32 bad.write_text("propellant_preset: ethalox\nchamber_geometry: 3\n")
33 rc = _script().main([str(bad)])
34 out = capsys.readouterr().out
35 assert rc == 1 and "FAIL" in out and str(bad) in out
36
37
39 assert _script().main([]) == 2
40 assert "check_config_load.py" in capsys.readouterr().out
test_a_broken_config_fails_with_the_loaders_reason(tmp_path, capsys)
int main()