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

535 system test #618

Merged
merged 9 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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)

Check warning on line 75 in src/blueapi/client/rest.py

View check run for this annotation

Codecov / codecov/patch

src/blueapi/client/rest.py#L75

Added line #L75 was not covered by tests

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
Loading