From 1c5bd44715573796b045213b3339d66f607d8781 Mon Sep 17 00:00:00 2001 From: Rose Yemelyanova Date: Thu, 14 Sep 2023 14:15:23 +0100 Subject: [PATCH] Add extra tests to pass patch --- tests/core/_device/test_device_collector.py | 11 +++++++++++ tests/core/test_async_status.py | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/core/_device/test_device_collector.py diff --git a/tests/core/_device/test_device_collector.py b/tests/core/_device/test_device_collector.py new file mode 100644 index 0000000000..2991064f32 --- /dev/null +++ b/tests/core/_device/test_device_collector.py @@ -0,0 +1,11 @@ +from ophyd_async.core import Device, DeviceCollector +import pytest + +class Dummy(Device): + def connect(self, sim: bool = False): + raise AttributeError() + +def test_device_collector_propagates_error(RE): + with pytest.raises(AttributeError): + with DeviceCollector(): + dummy = Dummy("somename") diff --git a/tests/core/test_async_status.py b/tests/core/test_async_status.py index 533756c59e..35b074bb2c 100644 --- a/tests/core/test_async_status.py +++ b/tests/core/test_async_status.py @@ -130,3 +130,9 @@ async def test_status_propogates_traceback_under_RE(RE) -> None: assert expected_call_stack == [ x.name for x in traceback.extract_tb(exception.__traceback__) ] + + +async def test_async_status_exception_timeout(): + st = AsyncStatus(asyncio.sleep(0.1)) + with pytest.raises(Exception): + st.exception(timeout=1.0)