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

Failing system tests for plans #783

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
16 changes: 16 additions & 0 deletions src/blueapi/startup/example_devices.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
from pathlib import Path
from tempfile import TemporaryDirectory

from dodal.common.beamlines.beamline_utils import set_path_provider
from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider
from ophyd.sim import Syn2DGauss, SynGauss, SynSignal

from .simmotor import BrokenSynAxis, SynAxisWithMotionEvents

# Some of our plans such as "count" and "spec_scan" require this global
# singleton to be set
_tmp_dir = Path(TemporaryDirectory().name)
set_path_provider(
StaticVisitPathProvider(
"t01",
_tmp_dir,
client=LocalDirectoryServiceClient(),
)
)


def x(name="x") -> SynAxisWithMotionEvents:
return SynAxisWithMotionEvents(name=name, delay=1.0, events_per_move=8)
Expand Down
40 changes: 40 additions & 0 deletions tests/system_tests/test_blueapi_system.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import inspect
import textwrap
import time
from pathlib import Path

import pytest
from bluesky_stomp.models import BasicAuthentication
from pydantic import TypeAdapter
from requests.exceptions import ConnectionError
from scanspec.specs import Line

from blueapi.client.client import (
BlueapiClient,
Expand Down Expand Up @@ -338,6 +340,44 @@ def test_get_current_state_of_environment(client: BlueapiClient):
assert client.get_environment() == EnvironmentResponse(initialized=True)


@pytest.mark.skip(
reason=textwrap.dedent("""
The client should block until environment reload is complete but it does not,
this interferes with subsequent tests. See
https://github.com/DiamondLightSource/blueapi/issues/742
""")
)
def test_delete_current_environment(client: BlueapiClient):
client.reload_environment()
assert client.get_environment() == EnvironmentResponse(initialized=True)


@pytest.mark.parametrize(
"task",
[
Task(
name="count",
params={
"detectors": [
"image_det",
"current_det",
],
"num": 5,
},
),
Task(
name="spec_scan",
params={
"detectors": [
"image_det",
"current_det",
],
"spec": Line("x", 0.0, 10.0, 10) * Line("y", 5.0, 15.0, 20),
},
),
],
)
def test_plan_runs(client_with_stomp: BlueapiClient, task: Task):
final_event = client_with_stomp.run_task(task)
assert final_event.is_complete() and not final_event.is_error()
assert final_event.state is WorkerState.IDLE
Loading