Skip to content

Commit

Permalink
535 system test (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh authored Sep 9, 2024
1 parent 09f65fe commit 0760630
Show file tree
Hide file tree
Showing 37 changed files with 1,744 additions and 20 deletions.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ legacy_tox_ini = """
[tox]
skipsdist=True
[testenv:{pre-commit,type-checking,tests,docs}]
[testenv:{pre-commit,type-checking,tests,docs,system-test}]
# Don't create a virtualenv for the command, requires tox-direct plugin
direct = True
passenv = *
Expand All @@ -121,8 +121,9 @@ allowlist_externals =
commands =
pre-commit: pre-commit run --all-files {posargs}
type-checking: mypy src tests {posargs}
tests: pytest --cov=blueapi --cov-report term --cov-report xml:cov.xml {posargs}
tests: pytest --cov=blueapi --cov-report term --cov-report xml:cov.xml tests/unit_tests {posargs}
docs: sphinx-{posargs:build -EW --keep-going} -T docs build/html
system-test: pytest tests/system_tests {posargs}
"""

[tool.ruff]
Expand Down
13 changes: 12 additions & 1 deletion src/blueapi/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
PlanModel,
PlanResponse,
TaskResponse,
TasksListResponse,
WorkerTask,
)
from blueapi.worker import Task, TrackableTask, WorkerEvent, WorkerState
Expand Down Expand Up @@ -142,9 +143,19 @@ def get_task(self, task_id: str) -> TrackableTask[Task]:
Returns:
TrackableTask[Task]: Task details
"""

assert task_id, "Task ID not provided!"
return self._rest.get_task(task_id)

def get_all_tasks(self) -> TasksListResponse:
"""
Get a list of all task stored by the worker
Returns:
TasksListResponse: List of all Trackable Task
"""

return self._rest.get_all_tasks()

def get_active_task(self) -> WorkerTask:
"""
Get the currently active task, if any
Expand Down
4 changes: 4 additions & 0 deletions src/blueapi/client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
PlanModel,
PlanResponse,
TaskResponse,
TasksListResponse,
WorkerTask,
)
from blueapi.worker import Task, TrackableTask, WorkerState
Expand Down Expand Up @@ -70,6 +71,9 @@ def set_state(
def get_task(self, task_id: str) -> TrackableTask[Task]:
return self._request_and_deserialize(f"/tasks/{task_id}", TrackableTask[Task])

def get_all_tasks(self) -> TasksListResponse:
return self._request_and_deserialize("/tasks", TasksListResponse)

def get_active_task(self) -> WorkerTask:
return self._request_and_deserialize("/worker/task", WorkerTask)

Expand Down
152 changes: 152 additions & 0 deletions tests/system_tests/devices.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"devices": [
{
"name": "sample_pressure",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "x_err",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "theta",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "z",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "y",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "x",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "current_det",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "image_det",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Pausable",
"Readable",
"Stageable",
"Stoppable",
"Subscribable",
"Configurable",
"Triggerable"
]
},
{
"name": "sample_temperature",
"protocols": [
"Checkable",
"HasHints",
"HasName",
"HasParent",
"Movable",
"Readable",
"Subscribable",
"Configurable",
"Triggerable"
]
}
]
}
Loading

0 comments on commit 0760630

Please sign in to comment.