Skip to content

Add shared dummy Tango attribute state#240

Merged
JeanLucPons merged 3 commits into
mainfrom
239-feature-shared-tango-attribute-state-in-dummy-control-system
Apr 22, 2026
Merged

Add shared dummy Tango attribute state#240
JeanLucPons merged 3 commits into
mainfrom
239-feature-shared-tango-attribute-state-in-dummy-control-system

Conversation

@gupichon
Copy link
Copy Markdown
Contributor

Description

Add shared state for dummy Tango attributes used in tests. This allows tests to initialize an attribute value before loading a configuration, and all later dummy DeviceAccess objects for the same Tango attribute share that value.

Related Issue

Features/issues described there are:

  • new feature: dummy Tango attributes now use a shared registry keyed by attribute name.

Changes to existing functionality

  • tango.pyaml.attribute delegates value, unit, range and readback storage to a shared registry.
  • attach_array() no longer relies on implicit [0.0, 1.0] initialization; tests initialize array attributes explicitly.
  • pytest clears the dummy Tango registry between tests.

Testing

The following tests were added or updated:

  • shared dummy Tango attribute state
  • read-only attribute initialization
  • indexed BPM test with explicit array initialization

Verify that your checklist complies with the project

  • New and existing unit tests pass locally
  • Tests were added to prove that all features/changes are effective
  • The code is commented where appropriate
  • Any existing features are not broken

@gupichon gupichon requested a review from JeanLucPons April 21, 2026 13:35
@gupichon gupichon self-assigned this Apr 21, 2026
@gupichon gupichon linked an issue Apr 21, 2026 that may be closed by this pull request
2 tasks
@JeanLucPons
Copy link
Copy Markdown
Contributor

On the code you write (not only on this PR) there is absolutely no comment. May be your code is clear for you but I often pain to read it. Please try to put few comments to explain a bit what the code do ! Few lines can help a lot other to understand and to maintain.
Last but not least there are lots of other priority task to do.
Thanks for understanding.

@gupichon
Copy link
Copy Markdown
Contributor Author

I'll add comments. I actually need this to simplify the BPM evolution and tests for other developments. For example, the attach_array method will be removed since it’s no longer necessary (it simply calls attach on the backends).

Moreover, it will simplify BPM testing as you’ll be able to set them to test values in live mode. This will allow for tests on the live system that were previously impossible.

@gupichon
Copy link
Copy Markdown
Contributor Author

By the way, I added a test for dummy-cs. It’s not mandatory, but it will help since it’s something we actually have to maintain..

@JeanLucPons
Copy link
Copy Markdown
Contributor

I'll add comments. I actually need this to simplify the BPM evolution and tests for other developments. For example, the attach_array method will be removed since it’s no longer necessary (it simply calls attach on the backends).

Not on the pyaml_cs_oa side, but this should change if the Ophyd Asynch fix is deployed.

@JeanLucPons
Copy link
Copy Markdown
Contributor

    def attach(self, devs: list[OASignal]) -> list[OASignal]:
        return self._attach(devs,False) # is_array=False

    def attach_array(self, devs: list[OASignal]) -> list[OASignal]:
        return self._attach(devs,True) # is_array=True

@gupichon
Copy link
Copy Markdown
Contributor Author

Not on the pyaml_cs_oa side, but this should change if the Ophyd Asynch fix is deployed.

I forgot about this point, you're right. Anyway, it will help a lot with testing, as you can set the live part with this development.

@JeanLucPons
Copy link
Copy Markdown
Contributor

Is it ready to merge ?

@gupichon
Copy link
Copy Markdown
Contributor Author

Is it ready to merge ?

Yes, all tests are passing, and I have added a test specifically for the dummy because, ultimately, we depend on it for delivery.

@JeanLucPons JeanLucPons merged commit 1569513 into main Apr 22, 2026
3 checks passed
@JeanLucPons JeanLucPons deleted the 239-feature-shared-tango-attribute-state-in-dummy-control-system branch April 22, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: shared Tango attribute state in dummy control system

4 participants