diff --git a/tests/conftest.py b/tests/conftest.py index 9e6c8c0209..027d49957c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -244,18 +244,3 @@ def one_shot_trigger_info() -> TriggerInfo: deadtime=None, livetime=None, ) - - -def pytest_collection_modifyitems(config, items): - tango_dir = "tests/tango" - - for item in items: - if tango_dir in str(item.fspath): - if sys.version_info >= (3, 12): - item.add_marker( - pytest.mark.skip( - reason="Tango is currently not supported on Python 3.12: https://github.com/bluesky/ophyd-async/issues/681" - ) - ) - else: - item.add_marker(pytest.mark.forked) diff --git a/tests/tango/test_base_device.py b/tests/tango/test_base_device.py index 60c6db9762..cc4f7fd9f4 100644 --- a/tests/tango/test_base_device.py +++ b/tests/tango/test_base_device.py @@ -298,7 +298,7 @@ def compare_values(expected, received): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_connect(tango_test_device): values, description = await describe_class(tango_test_device) @@ -311,7 +311,7 @@ async def test_connect(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_set_trl(tango_test_device): values, description = await describe_class(tango_test_device) test_device = TestTangoReadable(name="test_device") @@ -325,7 +325,7 @@ async def test_set_trl(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("proxy", [True, False, None]) async def test_connect_proxy(tango_test_device, proxy: bool | None): if proxy is None: @@ -345,7 +345,7 @@ async def test_connect_proxy(tango_test_device, proxy: bool | None): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_with_bluesky(tango_test_device): # now let's do some bluesky stuff RE = RunEngine() @@ -355,7 +355,7 @@ async def test_with_bluesky(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_demo(demo_test_context): with demo_test_context: detector = TangoDetector( diff --git a/tests/tango/test_tango_signals.py b/tests/tango/test_tango_signals.py index 0ec269527e..8842641ee6 100644 --- a/tests/tango/test_tango_signals.py +++ b/tests/tango/test_tango_signals.py @@ -331,7 +331,7 @@ async def assert_monitor_then_put( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_backend_get_put_monitor_attr(echo_device: str): try: for attr_data in ATTRIBUTES_SET: @@ -383,7 +383,7 @@ async def assert_put_read( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_backend_get_put_monitor_cmd( echo_device: str, ): @@ -401,7 +401,7 @@ async def test_backend_get_put_monitor_cmd( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_signal_r( echo_device: str, ): @@ -424,7 +424,7 @@ async def test_tango_signal_r( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_signal_w( echo_device: str, ): @@ -461,7 +461,7 @@ async def test_tango_signal_w( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_signal_rw( echo_device: str, ): @@ -490,7 +490,7 @@ async def test_tango_signal_rw( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_signal_x(tango_test_device: str): timeout = 0.2 for use_proxy in [True, False]: @@ -508,7 +508,7 @@ async def test_tango_signal_x(tango_test_device: str): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.skip("Not sure if we need tango_signal_auto") async def test_tango_signal_auto_attrs( echo_device: str, @@ -553,7 +553,7 @@ async def _test_signal(dtype, proxy, source, initial_value, put_value): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.skip("Not sure if we need tango_signal_auto") @pytest.mark.parametrize( "use_dtype, use_proxy", @@ -601,7 +601,7 @@ async def _test_signal(dtype, proxy, source, put_value): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.skip("Not sure if we need tango_signal_auto") async def test_tango_signal_auto_cmds_void(tango_test_device: str, use_proxy: bool): for use_proxy in [True, False]: @@ -618,7 +618,7 @@ async def test_tango_signal_auto_cmds_void(tango_test_device: str, use_proxy: bo # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.skip("Not sure if we need tango_signal_auto") async def test_tango_signal_auto_badtrl(tango_test_device: str): proxy = await DeviceProxy(tango_test_device) diff --git a/tests/tango/test_tango_transport.py b/tests/tango/test_tango_transport.py index 56387d3ef1..8598408f61 100644 --- a/tests/tango/test_tango_transport.py +++ b/tests/tango/test_tango_transport.py @@ -69,7 +69,7 @@ async def mock_func(self): # Test function -@pytest.mark.asyncio +@pytest.mark.forked async def test_ensure_proper_executor(): # Instantiate the helper class and call the decorated method helper_instance = HelperClass() @@ -154,7 +154,7 @@ def test_get_dtype_extended(datatype, expected): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize( "datatype, tango_resource, expected_descriptor", [ @@ -190,7 +190,7 @@ async def test_get_trl_descriptor( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize( "trl, proxy_needed, expected_type, should_raise", [ @@ -216,7 +216,7 @@ async def test_get_tango_trl( # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("attr", ["justvalue", "array"]) async def test_attribute_proxy_get(tango_test_device, attr): device_proxy = await DeviceProxy(tango_test_device) @@ -227,7 +227,7 @@ async def test_attribute_proxy_get(tango_test_device, attr): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize( "attr, wait", [("justvalue", True), ("justvalue", False), ("array", True), ("array", False)], @@ -251,7 +251,7 @@ async def test_attribute_proxy_put(tango_test_device, attr, wait): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("wait", [True, False]) async def test_attribute_proxy_put_force_timeout(tango_test_device, wait): device_proxy = await DeviceProxy(tango_test_device) @@ -263,7 +263,7 @@ async def test_attribute_proxy_put_force_timeout(tango_test_device, wait): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("wait", [True, False]) async def test_attribute_proxy_put_exceptions(tango_test_device, wait): device_proxy = await DeviceProxy(tango_test_device) @@ -275,7 +275,7 @@ async def test_attribute_proxy_put_exceptions(tango_test_device, wait): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize( "attr, new_value", [("justvalue", 10), ("array", np.array([[2, 3, 4], [5, 6, 7]]))] ) @@ -292,7 +292,7 @@ async def test_attribute_proxy_get_w_value(tango_test_device, attr, new_value): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_get_config(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) attr_proxy = AttributeProxy(device_proxy, "justvalue") @@ -301,7 +301,7 @@ async def test_attribute_get_config(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_get_reading(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) attr_proxy = AttributeProxy(device_proxy, "justvalue") @@ -310,7 +310,7 @@ async def test_attribute_get_reading(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_has_subscription(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) attr_proxy = AttributeProxy(device_proxy, "justvalue") @@ -320,7 +320,7 @@ async def test_attribute_has_subscription(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_subscribe_callback(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -349,7 +349,7 @@ def callback(reading): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_unsubscribe_callback(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -366,7 +366,7 @@ def callback(reading): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_set_polling(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) attr_proxy = AttributeProxy(device_proxy, "justvalue") @@ -379,7 +379,7 @@ async def test_attribute_set_polling(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_poll(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) attr_proxy = AttributeProxy(device_proxy, "floatvalue") @@ -438,7 +438,7 @@ def bad_callback(): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("attr", ["array", "label"]) async def test_attribute_poll_stringsandarrays(tango_test_device, attr): device_proxy = await DeviceProxy(tango_test_device) @@ -465,7 +465,7 @@ def callback(reading): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_attribute_poll_exceptions(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) # Try to poll a non-existent attribute @@ -482,7 +482,7 @@ def callback(reading, value): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_command_proxy_put_wait(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) cmd_proxy = CommandProxy(device_proxy, "clear") @@ -500,7 +500,7 @@ async def test_command_proxy_put_wait(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_command_proxy_put_nowait(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) cmd_proxy = CommandProxy(device_proxy, "slow_command") @@ -528,7 +528,7 @@ async def test_command_proxy_put_nowait(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("wait", [True, False]) async def test_command_proxy_put_exceptions(tango_test_device, wait): device_proxy = await DeviceProxy(tango_test_device) @@ -539,7 +539,7 @@ async def test_command_proxy_put_exceptions(tango_test_device, wait): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_command_get(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) cmd_proxy = CommandProxy(device_proxy, "clear") @@ -549,7 +549,7 @@ async def test_command_get(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_command_get_config(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) cmd_proxy = CommandProxy(device_proxy, "clear") @@ -558,7 +558,7 @@ async def test_command_get_config(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_command_get_reading(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) cmd_proxy = CommandProxy(device_proxy, "clear") @@ -568,7 +568,7 @@ async def test_command_get_reading(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_command_set_polling(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) cmd_proxy = CommandProxy(device_proxy, "clear") @@ -578,7 +578,7 @@ async def test_command_set_polling(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_init(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -587,7 +587,7 @@ async def test_tango_transport_init(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_source(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -597,7 +597,7 @@ async def test_tango_transport_source(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_datatype_allowed(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -614,7 +614,7 @@ async def test_tango_transport_datatype_allowed(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_connect(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -628,7 +628,7 @@ async def test_tango_transport_connect(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_connect_and_store_config(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -642,7 +642,7 @@ async def test_tango_transport_connect_and_store_config(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_put(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -660,7 +660,7 @@ async def test_tango_transport_put(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_get_datakey(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -673,7 +673,7 @@ async def test_tango_transport_get_datakey(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_get_reading(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -689,7 +689,7 @@ async def test_tango_transport_get_reading(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_get_value(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -705,7 +705,7 @@ async def test_tango_transport_get_value(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_get_setpoint(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -723,7 +723,7 @@ async def test_tango_transport_get_setpoint(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_set_callback(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -770,7 +770,7 @@ def callback(reading): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_set_polling(echo_device): await prepare_device(echo_device, "float_scalar_attr", 1.0) source = echo_device + "/" + "float_scalar_attr" @@ -780,7 +780,7 @@ async def test_tango_transport_set_polling(echo_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked @pytest.mark.parametrize("allow", [True, False]) async def test_tango_transport_allow_events(echo_device, allow): await prepare_device(echo_device, "float_scalar_attr", 1.0) @@ -791,7 +791,7 @@ async def test_tango_transport_allow_events(echo_device, allow): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_read_and_write_trl(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) # Must use a FQTRL, at least on windows. @@ -820,7 +820,7 @@ async def test_tango_transport_read_and_write_trl(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_read_only_trl(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) trl = device_proxy.dev_name() @@ -835,7 +835,7 @@ async def test_tango_transport_read_only_trl(tango_test_device): # -------------------------------------------------------------------- -@pytest.mark.asyncio +@pytest.mark.forked async def test_tango_transport_nonexistent_trl(tango_test_device): device_proxy = await DeviceProxy(tango_test_device) trl = device_proxy.dev_name()