diff --git a/extensions/eda/plugins/event_source/aws_sqs_queue.py b/extensions/eda/plugins/event_source/aws_sqs_queue.py index af77bb22..ca68f715 100644 --- a/extensions/eda/plugins/event_source/aws_sqs_queue.py +++ b/extensions/eda/plugins/event_source/aws_sqs_queue.py @@ -58,13 +58,20 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None: while True: # This loop won't spin really fast as there is # essentially a sleep in the receive_message call - response = await client.receive_message( + response_msg = await client.receive_message( QueueUrl=queue_url, WaitTimeSeconds=wait_seconds, ) - if "Messages" in response: - for msg in response["Messages"]: # type: ignore[typeddict-item] + if "Messages" in response_msg: + for msg in response_msg["Messages"]: + if ( + not isinstance(msg, dict) or "MessageId" not in msg + ): # pragma: no cover + err_msg = ( + f"Unexpected response {response_msg}, missing MessageId." + ) + raise ValueError(err_msg) meta = {"MessageId": msg["MessageId"]} try: msg_body = json.loads(msg["Body"]) diff --git a/extensions/eda/plugins/event_source/journald.py b/extensions/eda/plugins/event_source/journald.py index 71332fd6..2de64c50 100644 --- a/extensions/eda/plugins/event_source/journald.py +++ b/extensions/eda/plugins/event_source/journald.py @@ -79,7 +79,7 @@ async def main(queue: asyncio.Queue, args: dict[str, Any]) -> None: # noqa: D41 class MockQueue(asyncio.Queue[Any]): """A mock implementation of a queue that prints the event.""" - async def put(self: str, event: str) -> str: + async def put(self, event: str) -> str: """Add the event to the queue and print it.""" print(event) # noqa: T201 return "" diff --git a/pyproject.toml b/pyproject.toml index d24466c8..00ab4ad2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,10 +43,7 @@ error_summary = true disable_error_code = [ "assignment", "attr-defined", - "index", - "misc", "override", - "union-attr", "var-annotated", ] # strict = true diff --git a/tests/integration/event_source_webhook/test_webhook_source.py b/tests/integration/event_source_webhook/test_webhook_source.py index efe36254..9ec77d5c 100644 --- a/tests/integration/event_source_webhook/test_webhook_source.py +++ b/tests/integration/event_source_webhook/test_webhook_source.py @@ -15,6 +15,8 @@ def wait_for_events(proc: subprocess.Popen, timeout: float = 15.0): Requires the process to be running in debug mode. """ start = time.time() + if not proc.stdout: # pragma: no cover + return while stdout := proc.stdout.readline().decode(): if "Waiting for events" in stdout: break