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

Tests for AreaDetector drivers/plugins to insure attributes are regularly named #490

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

subinsaji
Copy link
Contributor

Closes #80

Recalling conversations with @coretl, in this PR we made changes to some names of attributes in order for tests to pass. New test that was created in here

import inflection
import pytest
from ophyd_async.core import Device, Signal
# Need to import them all so the subclass walking gets all subclasses
# If we forget then the full test suite will find the subclasses, but
# running just this test will only get the ones at the top of this file
from ophyd_async.epics import (
adaravis, # noqa
adcore,
adkinetix, # noqa
adpilatus, # noqa
adsimdetector, # noqa
advimba, # noqa
)
def get_rec_subclasses(cls: type):
yield cls
for subcls in cls.__subclasses__():
yield from get_rec_subclasses(subcls)
@pytest.mark.parametrize("cls", list(get_rec_subclasses(adcore.NDArrayBaseIO)))
async def test_regularly_named_attributes(cls: Device):
io = cls("")
for name, signal in io.children():
assert isinstance(signal, Signal)
# Strip off the ca:// prefix and an _RBV suffix
pv = signal.source.split("://")[-1].split("_RBV")[0]
assert inflection.underscore(pv) == name

needs to import all subsequent subclasses from from ophyd_async.epics for test coverage. If a developer adds more plugins or drivers, the developer must also import them.

@subinsaji subinsaji requested a review from coretl July 25, 2024 10:56
@subinsaji subinsaji marked this pull request as ready for review July 25, 2024 11:03
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.

Add test that areaDetector drivers and plugins have regularly named attributes
1 participant