Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for context race condition #600

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/epics/signal/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
from typing import Any, Literal
from unittest.mock import ANY

import bluesky.plan_stubs as bps
import numpy as np
import numpy.typing as npt
import pytest
from aioca import CANothing, purge_channel_caches
from bluesky.protocols import Reading
from bluesky.run_engine import RunEngine
from event_model import DataKey
from ophyd.signal import EpicsSignal
from typing_extensions import TypedDict

from ophyd_async.core import (
Expand Down Expand Up @@ -917,3 +920,21 @@ async def test_signals_created_for_not_prec_0_float_cannot_use_int(ioc: IOC):
TypeError, match=f"{ioc.protocol}:float_prec_1 has type float not int"
):
await sig.connect()


async def test_can_read_using_ophyd_async_then_ophyd(ioc: IOC):
oa_read = f"{ioc.protocol}://{PV_PREFIX}:{ioc.protocol}:float_prec_1"
ophyd_read = f"{PV_PREFIX}:{ioc.protocol}:float_prec_0"

ophyd_async_sig = epics_signal_rw(float, oa_read)
await ophyd_async_sig.connect()
ophyd_signal = EpicsSignal(ophyd_read)
ophyd_signal.wait_for_connection(timeout=5)

RE = RunEngine()

def my_plan():
yield from bps.rd(ophyd_async_sig)
yield from bps.rd(ophyd_signal)

RE(my_plan())
Loading