Skip to content

Commit f033b8c

Browse files
committed
Fix tests and add fastcs example to techui_support fixture
Add new fastcs example service
1 parent f7d6c9f commit f033b8c

3 files changed

Lines changed: 62 additions & 4 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# yaml-language-server: $schema=schema.json
2+
controllers:
3+
- name: BL01T-EA-TEST-01
4+
type: fastcs.TemperatureController
5+
ip_settings:
6+
ip: "localhost"
7+
port: 25565
8+
num_ramp_controllers: 4
9+
10+
transport:
11+
- graphql:
12+
host: localhost
13+
port: 8083
14+
log_level: info
15+
- epicsca: {}
16+
gui:
17+
title: Temperature Controller Demo
18+
output_dir: .

tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def techui_support():
8383
},
8484
],
8585
),
86+
"fastcs.TemperatureController": SupportEntity(
87+
prefix="{{ name }}", macros=["name"], screens=[{}]
88+
),
8689
}
8790

8891
return ts

tests/test_builder.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,51 @@ def test_missing_service(builder, caplog):
179179
),
180180
],
181181
)
182-
def test_gb_extract_entities(builder_with_setup, index, type, desc, pv, macros): # noqa: N803
182+
def test_gb_extract_entities_ioc_yaml(
183+
builder, techui_support, index, type, desc, pv, macros
184+
):
185+
# We don't want to use builder_with_setup as that calls _extract_services()
186+
# and in turn that calls _extract_entities()
187+
builder.techui_support = techui_support
183188
prefix = pv.split(":", maxsplit=1)[0]
184189

185-
builder_with_setup._extract_entities(
190+
builder._extract_entities(
186191
"bl01t-mo-ioc-01",
187-
builder_with_setup._services_dir.joinpath("bl01t-mo-ioc-01/config/ioc.yaml"),
192+
builder._services_dir.joinpath("bl01t-mo-ioc-01/config/ioc.yaml"),
193+
)
194+
entity = builder.entities[prefix][index]
195+
assert entity.type == type
196+
assert entity.desc == desc
197+
assert entity.prefix == pv
198+
assert entity.macros == macros
199+
200+
201+
@pytest.mark.parametrize(
202+
"index, type, desc, pv, macros",
203+
[
204+
(
205+
0,
206+
"fastcs.TemperatureController",
207+
None,
208+
"BL01T-EA-TEST-01",
209+
{"name": "BL01T-EA-TEST-01"},
210+
),
211+
],
212+
)
213+
def test_gb_extract_entities_fastcs_yaml(
214+
builder, techui_support, index, type, desc, pv, macros
215+
):
216+
# We don't want to use builder_with_setup as that calls _extract_services()
217+
# and in turn that calls _extract_entities()
218+
builder.techui_support = techui_support
219+
220+
prefix = pv.split(":", maxsplit=1)[0]
221+
222+
builder._extract_entities(
223+
"bl01t-ea-ioc-01",
224+
builder._services_dir.joinpath("bl01t-ea-ioc-01/config/fastcs.yaml"),
188225
)
189-
entity = builder_with_setup.entities[prefix][index]
226+
entity = builder.entities[prefix][index]
190227
assert entity.type == type
191228
assert entity.desc == desc
192229
assert entity.prefix == pv

0 commit comments

Comments
 (0)