Skip to content

Commit

Permalink
cleaned up after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Jan 28, 2025
1 parent 4f675eb commit 379f006
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/fastcs/transport/epics/ioc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import warnings
from collections.abc import Callable
from types import MethodType
from typing import Any, Literal
Expand Down
12 changes: 2 additions & 10 deletions src/fastcs/transport/tango/dsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ async def fget(tango_device: Device):
return fget


def _tango_display_format(attribute: Attribute) -> str:
match attribute.datatype:
case Float(prec):
return f"%.{prec}"

return "6.2f" # `tango.server.attribute` default for `format`


async def _run_threadsafe_blocking(
coro: Coroutine[Any, Any, Any], loop: asyncio.AbstractEventLoop
) -> None:
Expand All @@ -59,9 +51,9 @@ def _wrap_updater_fset(
) -> Callable[[Any, Any], Any]:
cast_method = get_cast_method_from_tango_type(attribute.datatype)

async def fset(tango_device: Device, val):
async def fset(tango_device: Device, value):
tango_device.info_stream(f"called fset method: {attr_name}")
coro = attribute.process(val)
coro = attribute.process(cast_method(value))
await _run_threadsafe_blocking(coro, loop)

return fset
Expand Down
7 changes: 1 addition & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@
import pytest
from aioca import purge_channel_caches

from fastcs.attributes import AttrR, AttrRW, AttrW, Handler, Sender, Updater
from fastcs.controller import Controller, SubController
from fastcs.datatypes import Bool, Float, Int, String
from fastcs.transport.tango.dsr import register_dev
from fastcs.datatypes import Bool, Enum, Float, Int, String, WaveForm
from fastcs.wrappers import command, scan
from fastcs.attributes import AttrR, AttrRW, AttrW
from fastcs.datatypes import Bool, Float, Int, String
from fastcs.transport.tango.dsr import register_dev
from tests.assertable_controller import (
TestController,
TestHandler,
Expand Down
10 changes: 8 additions & 2 deletions tests/transport/tango/test_dsr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
from unittest import mock

import enum
from unittest import mock

import numpy as np
import pytest
Expand All @@ -22,6 +21,8 @@

async def patch_run_threadsafe_blocking(coro, loop):
await coro


class TangoAssertableController(AssertableController):
read_int = AttrR(Int(), handler=TestUpdater())
read_write_int = AttrRW(Int(), handler=TestHandler())
Expand All @@ -34,6 +35,11 @@ class TangoAssertableController(AssertableController):
two_d_waveform = AttrRW(WaveForm(np.int32, (10, 10)))


@pytest.fixture(scope="class")
def assertable_controller(class_mocker: MockerFixture):
return TangoAssertableController(class_mocker)


class TestTangoDevice:
@pytest.fixture(scope="class")
def tango_context(self, assertable_controller):
Expand Down

0 comments on commit 379f006

Please sign in to comment.