-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d90edd
commit 193a3df
Showing
4 changed files
with
40 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from bluesky import RunEngine | ||
from bluesky.plan_stubs import rd | ||
from ophyd import Component, Device, EpicsSignal | ||
|
||
|
||
class Synchrotron(Device): | ||
ring_current: EpicsSignal = Component(EpicsSignal, "SR-DI-DCCT-01:SIGNAL") | ||
|
||
|
||
def test_plan(synch: Synchrotron): | ||
current = yield from rd(synch.ring_current) | ||
print(current) | ||
|
||
|
||
def run_plan(): | ||
RE = RunEngine() | ||
my_synch = Synchrotron(name="Synchrotron") | ||
my_synch.wait_for_connection() | ||
RE(test_plan(my_synch)) |
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,16 @@ | ||
from unittest.mock import patch | ||
|
||
from bluesky import RunEngine | ||
from ophyd.sim import make_fake_device | ||
|
||
from mx_bluesky.example import Synchrotron, test_plan | ||
|
||
|
||
@patch("mx_bluesky.example.print") | ||
def test_example_reads_correct_value(mock_print): | ||
fake_device: Synchrotron = make_fake_device(Synchrotron)(name="fake_synch") | ||
fake_device.ring_current.sim_put(378.8) | ||
RE = RunEngine() | ||
RE(test_plan(fake_device)) | ||
|
||
assert mock_print.called_once_with(str(378.8)) |