Skip to content

Commit 82f8c98

Browse files
committed
Fix tests, formatting and linting
1 parent 7a32987 commit 82f8c98

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
@@ -457,7 +457,10 @@ def _on_document(self, name: str, document: Mapping[str, Any]) -> None:
457457

458458
correlation_id = self._current.request_id
459459
self._data_events.publish(
460-
DataEvent(name=name, task_id=self._current.task_id, doc=document), correlation_id
460+
DataEvent(
461+
name=name, task_id=self._current.task_id, doc=document
462+
),
463+
correlation_id,
461464
)
462465
else:
463466
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
@@ -376,10 +376,10 @@ def test_worker_and_data_events_produce_in_order(
376376
errors=[],
377377
warnings=[],
378378
),
379-
DataEvent(name="start", doc={}),
380-
DataEvent(name="descriptor", doc={}),
381-
DataEvent(name="event", doc={}),
382-
DataEvent(name="stop", doc={}),
379+
DataEvent(name="start", doc={}, task_id="0000-1111"),
380+
DataEvent(name="descriptor", doc={}, task_id="0000-1111"),
381+
DataEvent(name="event", doc={}, task_id="0000-1111"),
382+
DataEvent(name="stop", doc={}, task_id="0000-1111"),
383383
WorkerEvent(
384384
state=WorkerState.IDLE,
385385
task_status=TaskStatus(

0 commit comments

Comments
 (0)