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 1 commit
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 @@ -13,11 +13,14 @@
from typing import Any, Dict, Literal, Optional, Sequence, Tuple, Type
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 DataKey, Reading
from bluesky.run_engine import RunEngine
from ophyd.signal import EpicsSignal
from typing_extensions import TypedDict

from ophyd_async.core import (
Expand Down Expand Up @@ -901,3 +904,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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put any timeouts in here, or does it just hang anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It hangs either way but I've added it anyway


RE = RunEngine()

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

RE(my_plan())
Loading