-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for AreaDetector drivers/plugins to insure attributes are regul…
…arly named (#490) * changed some __init__ variable names and added new test for subclasses * pv set in stone so change attribute name to match * subsequent changes to attribute rename elsewhere * changing other PR attribute names to keep regularly named test happy
- Loading branch information
Showing
13 changed files
with
87 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 |