-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_fake_sensor.py
More file actions
40 lines (31 loc) · 887 Bytes
/
test_fake_sensor.py
File metadata and controls
40 lines (31 loc) · 887 Bytes
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
import pathlib
import subprocess
import sys
import time
import math
import numpy as np
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-sensor", config=config)
def test_keys():
c = yaqc.Client(39426)
assert "random_walk" in c.get_measured()
assert "measurement_id" in c.get_measured()
@testing.run_daemon_entry_point("fake-sensor", config=config)
def test_measurement_id():
c = yaqc.Client(39426)
time.sleep(0.2)
first = c.get_measurement_id()
time.sleep(0.2)
second = c.get_measurement_id()
assert isinstance(first, int)
assert isinstance(second, int)
assert second > first
d = c.get_measured()
assert isinstance(d["measurement_id"], int)
if __name__ == "__main__":
test_keys()
test_measurement_id()