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

Investigate failing config_data test #773

Open
danielballan opened this issue Jul 5, 2023 · 0 comments
Open

Investigate failing config_data test #773

danielballan opened this issue Jul 5, 2023 · 0 comments

Comments

@danielballan
Copy link
Member

I added an xfail to this test in #772

@pytest.mark.xfail(reason="Possibly broken by predeclare, need investigation")
def test_config_data(db, RE, hw):
# simple case: one Event Descriptor, one stream
RE.subscribe(db.insert)
from ophyd import Device, sim, Component as C
class SynWithConfig(Device):
x = C(sim.Signal, value=0)
y = C(sim.Signal, value=2)
z = C(sim.Signal, value=3)
det = SynWithConfig(name='det')
det.x.name = 'x'
det.y.name = 'y'
det.z.name = 'z'
det.read_attrs = ['x']
det.configuration_attrs = ['y', 'z']
uid, = get_uids(RE(count([det])))
h = db[uid]
actual = h.config_data('det')
expected = {'primary': [{'y': 2, 'z': 3}]}
assert actual == expected
# generate two Event Descriptors in the primary stream
@run_decorator()
def plan():
# working around 'yield from' here which breaks py2
for msg in configure(det, {'z': 3}): # no-op
yield msg
for msg in trigger_and_read([det]):
yield msg
# changing the config after a read generates a new Event Descriptor
for msg in configure(det, {'z': 4}):
yield msg
for msg in trigger_and_read([det]):
yield msg
uid, = get_uids(RE(plan()))
h = db[uid]
actual = h.config_data('det')
expected = {'primary': [{'y': 2, 'z': 3}, {'y': 2, 'z': 4}]}
assert actual == expected
# generate two streams, primary and baseline -- one Event Descriptor each
uid, = get_uids(RE(baseline_wrapper(count([det]), [det])))
h = db[uid]
actual = h.config_data('det')
expected = {'primary': [{'y': 2, 'z': 4}],
'baseline': [{'y': 2, 'z': 4}]}
assert actual == expected
# https://github.com/bluesky/databroker/issues/745
if hasattr(db, 'v2'):
db.v2[uid]['primary']['config']['det']['y'][:]
db.v2[uid]['primary']['config']['det']['z'][:]

This failed around the same time as other tests failed due to the change to bluesky that introduced pre-declaring streams by default. I suspect this may be related to that, but have not closely investigated.

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

No branches or pull requests

1 participant