Update tests/test_utils_pv.py
Run CI Tests / test (push) Successful in 57s

This commit is contained in:
2025-08-05 17:16:04 +02:00
parent 7882c92460
commit eb8298c519
+12 -18
View File
@@ -7,18 +7,6 @@ from io import StringIO
import colorama
from slic.utils.pv import PV
pv = PV("TEST:VAL")
print("PV backend:", type(PV))
print("✅ PV instance class:", pv.__class__)
print("✅ PV module origin:", pv.__class__.__module__)
print("✅ PV class name:", pv.__class__.__name__)
print("✅ PV full repr:", repr(pv))
print("✅ PV dir:", dir(pv))
'''
# Caproto is used to simulate a real EPICS IOC for testing
from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
@@ -37,15 +25,22 @@ def run_test_ioc():
prefix = "TEST:"
ioc = TestIOC(prefix=prefix)
def start_ioc():
asyncio.run(run(ioc.pvdb, startup_hook=None, interfaces=["127.0.0.1"]))
# Avoid parsing pytest args
_, run_options = ioc_arg_parser(
default_prefix=prefix,
desc="Test IOC",
argv=["--prefix", prefix, "--verbose"]
)
thread = threading.Thread(target=start_ioc, daemon=True)
thread.start()
time.sleep(4.0) # Give the IOC time to come up
ioc.start(run_options)
print("✅ IOC started with PVs:", list(ioc.pvdb.keys()))
time.sleep(1)
yield
# Optional: shutdown logic if needed
# Fixture to capture stdout (for tqdm / progress bar)
@pytest.fixture
@@ -122,4 +117,3 @@ def test_use_callback_context_manager():
# After context manager exit, callback should be removed
assert len(pv._callbacks) == initial_count
'''