Skip to content

Commit

Permalink
fixed test and cleaned up after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Sep 17, 2024
1 parent df5b9f6 commit 8f5c4c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import asyncio
from typing import Optional

from pydantic import Field

from ophyd_async.core import DetectorControl, PathProvider
from ophyd_async.core._detector import TriggerInfo

Expand Down
34 changes: 15 additions & 19 deletions tests/epics/adsimdetector/test_sim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Integration tests for a StandardDetector using a ADHDFWriter and SimController."""

import asyncio
import time
from collections import defaultdict
from pathlib import Path
Expand Down Expand Up @@ -353,31 +352,28 @@ def test_detector_with_unnamed_or_disconnected_config_sigs(

some_other_driver = adcore.ADBaseIO("TEST", name=driver_name)

async with DeviceCollector(mock=True):
det = adsimdetector.SimDetector(
"FOO:",
dp,
name="foo",
)
det = adsimdetector.SimDetector(
"FOO:",
dp,
name="foo",
)

det._config_sigs = [some_other_driver.acquire_time, det.drv.acquire]

with pytest.raises(Exception) as exc:
RE(count_sim([det], times=1))

assert isinstance(exc.value.args[0], AsyncStatus)
assert (
str(exc.value.args[0].exception())
== "config signal must be named before it is passed to the detector"
)

def plan():
def my_plan():
yield from ops.ensure_connected(det, mock=True)
assert det.drv.acquire.name == "foo-drv-acquire"
assert some_other_driver.acquire_time.name == (
driver_name + "-acquire_time" if driver_name else ""
)

yield from count_sim([det], times=1)

loop = asyncio.get_event_loop()
with pytest.raises(Exception) as exc:
RE(plan(), loop=loop)
RE(my_plan())

assert isinstance(exc.value.args[0], AsyncStatus)
assert str(exc.value.args[0].exception()) == error_output

# Need to unstage to properly kill tasks
RE(bps.unstage(det, wait=True))

0 comments on commit 8f5c4c7

Please sign in to comment.