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

add tests for all built-in plans #24

Merged
merged 20 commits into from
Sep 7, 2020
24 changes: 24 additions & 0 deletions tests/count/test_count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import count


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
def test_simple_count():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
RE(count([sensor], 41))


if __name__ == "__main__":
test_simple_count()
2 changes: 2 additions & 0 deletions tests/count/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/grid_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
27 changes: 27 additions & 0 deletions tests/grid_scan/test_grid_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import grid_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_grid_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
RE(grid_scan([sensor], hardware, -10, 10, 15))


if __name__ == "__main__":
test_simple_grid_scan()
2 changes: 2 additions & 0 deletions tests/grid_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/list_grid_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
28 changes: 28 additions & 0 deletions tests/list_grid_scan/test_list_grid_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import list_grid_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_list_grid_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
lis = [-10, -8, 4, 2, 10]
RE(list_grid_scan([sensor], hardware, lis))


if __name__ == "__main__":
test_simple_list_grid_scan()
2 changes: 2 additions & 0 deletions tests/list_grid_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/list_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
28 changes: 28 additions & 0 deletions tests/list_scan/test_list_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import list_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_list_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
lis = [-10, -8, 4, 2, 10]
RE(list_scan([sensor], hardware, lis))


if __name__ == "__main__":
test_simple_list_scan()
2 changes: 2 additions & 0 deletions tests/list_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/log_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
27 changes: 27 additions & 0 deletions tests/log_scan/test_log_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import log_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_log_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
RE(log_scan([sensor], hardware, -10, 10, 15))


if __name__ == "__main__":
test_simple_log_scan()
2 changes: 2 additions & 0 deletions tests/log_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/rel_grid_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
27 changes: 27 additions & 0 deletions tests/rel_grid_scan/test_rel_grid_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import rel_grid_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_rel_grid_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
RE(rel_grid_scan([sensor], hardware, -1, 1, 15))


if __name__ == "__main__":
test_simple_rel_grid_scan()
2 changes: 2 additions & 0 deletions tests/rel_grid_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/rel_list_grid_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
28 changes: 28 additions & 0 deletions tests/rel_list_grid_scan/test_rel_list_grid_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import rel_list_grid_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_rel_list_grid_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
lis = [-0.1, 0, 0.1, 0.2, 0.5]
RE(rel_list_grid_scan([sensor], hardware, lis))


if __name__ == "__main__":
test_simple_rel_list_grid_scan()
2 changes: 2 additions & 0 deletions tests/rel_list_grid_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/rel_list_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
28 changes: 28 additions & 0 deletions tests/rel_list_scan/test_rel_list_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import rel_list_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_rel_list_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
lis = [-0.1, 0, 0.1, 0.2, 0.5]
RE(rel_list_scan([sensor], hardware, lis))


if __name__ == "__main__":
test_simple_rel_list_scan()
2 changes: 2 additions & 0 deletions tests/rel_list_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/rel_log_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
27 changes: 27 additions & 0 deletions tests/rel_log_scan/test_rel_log_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import rel_log_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_rel_log_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
RE(rel_log_scan([sensor], hardware, -10, 10, 15))


if __name__ == "__main__":
test_simple_rel_log_scan()
2 changes: 2 additions & 0 deletions tests/rel_log_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
2 changes: 2 additions & 0 deletions tests/rel_scan/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[hardware]
port = 39424
28 changes: 28 additions & 0 deletions tests/rel_scan/test_rel_scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pathlib
import time
import subprocess
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import rel_scan


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_rel_scan():
RE = RunEngine()
hardware = yaqc_bluesky.Device(39424)
print(hardware.stop)
sensor = yaqc_bluesky.Device(39425)
RE(rel_scan([sensor], hardware, -1, 1, 15))


if __name__ == "__main__":
test_simple_rel_scan()
2 changes: 2 additions & 0 deletions tests/rel_scan/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
5 changes: 5 additions & 0 deletions tests/rel_spiral/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[hardware1]
port = 39423

[hardware2]
port = 39424
35 changes: 35 additions & 0 deletions tests/rel_spiral/test_rel_spiral.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pathlib
import time
import subprocess
from cycler import cycler
import yaqc_bluesky
from yaqd_core import testing
from bluesky import RunEngine
from bluesky.plans import rel_spiral


__here__ = pathlib.Path(__file__).parent


@testing.run_daemon_entry_point(
"fake-triggered-sensor", config=__here__ / "triggered-sensor-config.toml"
)
@testing.run_daemon_entry_point(
"fake-continuous-hardware", config=__here__ / "continuous-hardware-config.toml"
)
def test_simple_rel_spiral():
RE = RunEngine()
hardware_x = yaqc_bluesky.Device(39423)
hardware_y = yaqc_bluesky.Device(39424)
sensor = yaqc_bluesky.Device(39425)
hardware_x.set(0)
hardware_y.set(0)
RE(
rel_spiral(
[sensor], x_motor=hardware_x, y_motor=hardware_y, x_range=1, y_range=1, dr=0.5, nth=10
)
)


if __name__ == "__main__":
test_simple_rel_spiral()
2 changes: 2 additions & 0 deletions tests/rel_spiral/triggered-sensor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sensor]
port = 39425
5 changes: 5 additions & 0 deletions tests/rel_spiral_fermat/continuous-hardware-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[hardware1]
port = 39423

[hardware2]
port = 39424
Loading