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
3
It read '/Users/carlton/Downloads/Layer 3 Optimized Config.yaml' and printed a pintle-only field, so
4
on any other machine it died with FileNotFoundError and on an impinging design it checked nothing.
5
"""
6
7
from
__future__
import
annotations
8
9
import
importlib.util
10
from
pathlib
import
Path
11
12
ROOT = Path(__file__).resolve().parents[1]
13
14
15
def
_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
22
def
test_shipped_configs_of_both_injectors_load
(capsys):
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
30
def
test_a_broken_config_fails_with_the_loaders_reason
(tmp_path, capsys):
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
38
def
test_no_arguments_is_a_usage_line
(capsys):
39
assert
_script
().
main
([]) == 2
40
assert
"check_config_load.py"
in
capsys.readouterr().out
test_check_config_load.test_shipped_configs_of_both_injectors_load
test_shipped_configs_of_both_injectors_load(capsys)
Definition
test_check_config_load.py:22
test_check_config_load.test_no_arguments_is_a_usage_line
test_no_arguments_is_a_usage_line(capsys)
Definition
test_check_config_load.py:38
test_check_config_load._script
_script()
Definition
test_check_config_load.py:15
test_check_config_load.test_a_broken_config_fails_with_the_loaders_reason
test_a_broken_config_fails_with_the_loaders_reason(tmp_path, capsys)
Definition
test_check_config_load.py:30
main
int main()
Definition
test_abort_ordering.cpp:67
EngineDesign
tests
test_check_config_load.py
Generated by
1.15.0