diff --git a/TEM_comms/__init__.py b/TEM_comms/__init__.py index c997f0f..6199595 100644 --- a/TEM_comms/__init__.py +++ b/TEM_comms/__init__.py @@ -5,6 +5,7 @@ from . import tile from . import ui from . import montage +from . import qc topics = { @@ -34,4 +35,5 @@ "ui.setup": ui.Setup, "montage.start": montage.Start, "montage.finished": montage.Finished, + "qc.status": qc.Status, } diff --git a/TEM_comms/qc.py b/TEM_comms/qc.py new file mode 100644 index 0000000..fbcfb18 --- /dev/null +++ b/TEM_comms/qc.py @@ -0,0 +1,6 @@ +from pigeon import BaseMessage +from typing import Literal + + +class Status(BaseMessage): + state: Literal["GOOD", "STOP_AT_END", "STOP_NOW"] diff --git a/pyproject.toml b/pyproject.toml index 8caef8c..8ec86f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pigeon-tem-comms" -version = "0.4.0" +version = "0.4.1" authors = [ { name="Cameron Devine", email="cameron.devine@alleninstitute.org" }, ] diff --git a/tests/test_qc.py b/tests/test_qc.py new file mode 100644 index 0000000..15b4339 --- /dev/null +++ b/tests/test_qc.py @@ -0,0 +1,8 @@ +from TEM_comms.qc import Status +from pydantic import ValidationError +import pytest + + +def test_bad_status(): + with pytest.raises(ValidationError): + Status(state="BAD")