Skip to content

Commit 4a82575

Browse files
committed
ENH: placeholder for snapshot controller tests
1 parent 6c76bc3 commit 4a82575

File tree

6 files changed

+34
-17
lines changed

6 files changed

+34
-17
lines changed

ioc/sim_ioc.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ class SimpleIOC(PVGroup):
99
1010
Scalar PVs
1111
----------
12-
A (int)
13-
B (float)
14-
15-
Array PVs
16-
---------
17-
C (array of int)
12+
A, B, C, D, E, F, G, H, I, J (float)
1813
"""
1914

2015
A = pvproperty(value=1.0, doc="Value A")

tests/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ def ioc():
133133

134134
def _reset_ioc():
135135
for pv, val in ioc_pvs.items():
136-
caget(pv)
137-
caput(pv, val)
136+
v = caget(pv)
137+
if v != val:
138+
caput(pv, val)
138139

139140
_reset_ioc()
140141
yield

tests/test_config_control.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24

35
import pytest

tests/test_misc.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import importlib.metadata
55

66
import pytest
7-
from epics import caget
87

98
import save_and_restore_api
109
from save_and_restore_api import SaveRestoreAPI as SaveRestoreAPI_Threads
@@ -16,8 +15,6 @@
1615
admin_username,
1716
base_url,
1817
clear_sar, # noqa: F401
19-
ioc, # noqa: F401
20-
ioc_pvs,
2118
read_password,
2219
read_username,
2320
user_password,
@@ -103,9 +100,3 @@ async def testing():
103100
await SR.login(username=username, password=password)
104101

105102
asyncio.run(testing())
106-
107-
108-
109-
def test_epics(ioc): # noqa: F811
110-
for pv, value in ioc_pvs.items():
111-
assert caget(pv) == value, f"PV {pv} has value {caget(pv)}, expected {value}"

tests/test_snapshot_control.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from __future__ import annotations
2+
3+
# import asyncio
4+
# import pytest
5+
from epics import caget
6+
7+
# from save_and_restore_api import SaveRestoreAPI as SaveRestoreAPI_Threads
8+
# from save_and_restore_api.aio import SaveRestoreAPI as SaveRestoreAPI_Async
9+
from .common import (
10+
# _is_async,
11+
# _select_auth,
12+
# base_url,
13+
clear_sar, # noqa: F401
14+
# create_root_folder,
15+
ioc, # noqa: F401
16+
ioc_pvs,
17+
)
18+
19+
# =============================================================================================
20+
# TESTS FOR SNAPSHOT-CONTROLLER API METHODS
21+
# =============================================================================================
22+
23+
24+
def test_epics(ioc): # noqa: F811
25+
for pv, value in ioc_pvs.items():
26+
assert caget(pv) == value, f"PV {pv} has value {caget(pv)}, expected {value}"

tests/test_tag_control.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24

35
import pytest

0 commit comments

Comments
 (0)