-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_discrete_hardware.py
More file actions
55 lines (46 loc) · 1.65 KB
/
test_discrete_hardware.py
File metadata and controls
55 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pathlib
import subprocess
import sys
import time
import math
import pytest
import yaqc
import yaqd_core
from yaqd_core import testing
config = pathlib.Path(__file__).parent / "config.toml"
@testing.run_daemon_entry_point("fake-discrete-hardware", config=config)
def test_set_identifier():
c = yaqc.Client(39425)
for k, v in c.get_position_identifiers().items():
c.set_identifier(k)
time.sleep(0.1)
assert c.get_identifier() == k
@testing.run_daemon_entry_point("fake-discrete-hardware", config=config)
def test_units_set():
c = yaqc.Client(39425)
assert c.get_units() == "deg"
@testing.run_daemon_entry_point("fake-discrete-hardware", config=config)
def test_properties():
c = yaqc.Client(39425)
assert "position" in c.properties
assert c.properties.position.units() == "deg"
assert c.properties.position.control_kind == "hinted"
assert c.properties.position.record_kind == "data"
assert c.properties.position.type == "double"
assert "destination" in c.properties
assert c.properties.destination.units() == "deg"
assert c.properties.destination.control_kind == "hinted"
assert c.properties.destination.record_kind == "data"
assert c.properties.destination.type == "double"
assert "position_identifier" in c.properties
assert set(c.properties.position_identifier.options()) == {
"red",
"orange",
"yellow",
"green",
"blue",
"violet",
}
assert c.properties.position_identifier.control_kind == "hinted"
assert c.properties.position_identifier.record_kind == "data"
assert c.properties.position_identifier.type == "string"