Skip to content

Commit f24d51a

Browse files
committed
Fix tests, formatting and linting
1 parent 5c2433f commit f24d51a

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/blueapi/worker/task_worker.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,10 @@ def _on_document(self, name: str, document: Mapping[str, Any]) -> None:
465465

466466
correlation_id = self._current.request_id
467467
self._data_events.publish(
468-
DataEvent(name=name, task_id=self._current.task_id, doc=document), correlation_id
468+
DataEvent(
469+
name=name, task_id=self._current.task_id, doc=document
470+
),
471+
correlation_id,
469472
)
470473
else:
471474
raise ValueError(

tests/unit_tests/client/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def test_run_task_fails_on_failing_event(
434434
),
435435
),
436436
ProgressEvent(task_id="foo"),
437-
DataEvent(name="start", doc={}),
437+
DataEvent(name="start", doc={}, task_id="0000-1111"),
438438
],
439439
)
440440
def test_run_task_calls_event_callback(

tests/unit_tests/test_cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,9 @@ def test_plan_output_formatting():
657657

658658
def test_event_formatting():
659659
data = DataEvent(
660-
name="start", doc={"foo": "bar", "fizz": {"buzz": (1, 2, 3), "hello": "world"}}
660+
name="start",
661+
doc={"foo": "bar", "fizz": {"buzz": (1, 2, 3), "hello": "world"}},
662+
task_id="0000-1111",
661663
)
662664
worker = WorkerEvent(
663665
state=WorkerState.RUNNING,
@@ -672,7 +674,8 @@ def test_event_formatting():
672674
data,
673675
(
674676
"""{"name": "start", "doc": """
675-
"""{"foo": "bar", "fizz": {"buzz": [1, 2, 3], "hello": "world"}}}\n"""
677+
"""{"foo": "bar", "fizz": {"buzz": [1, 2, 3], "hello": "world"}}, """
678+
""""task_id": "0000-1111"}\n"""
676679
),
677680
)
678681
_assert_matching_formatting(OutputFormat.COMPACT, data, "Data Event: start\n")

tests/unit_tests/worker/test_task_worker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ def test_worker_and_data_events_produce_in_order(
389389
errors=[],
390390
warnings=[],
391391
),
392-
DataEvent(name="start", doc={}),
393-
DataEvent(name="descriptor", doc={}),
394-
DataEvent(name="event", doc={}),
395-
DataEvent(name="stop", doc={}),
392+
DataEvent(name="start", doc={}, task_id="0000-1111"),
393+
DataEvent(name="descriptor", doc={}, task_id="0000-1111"),
394+
DataEvent(name="event", doc={}, task_id="0000-1111"),
395+
DataEvent(name="stop", doc={}, task_id="0000-1111"),
396396
WorkerEvent(
397397
state=WorkerState.IDLE,
398398
task_status=TaskStatus(

0 commit comments

Comments
 (0)