Skip to content

Commit faca7fc

Browse files
committed
Merge remote-tracking branch 'origin/main' into refactor-tests
2 parents fa368e6 + 6bf1c23 commit faca7fc

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ on:
99
jobs:
1010
test:
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
py: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15+
1416
runs-on: ubuntu-24.04
1517
steps:
1618
- uses: actions/checkout@v4
@@ -24,5 +26,6 @@ jobs:
2426
- name: Run a Wokwi CI server
2527
uses: wokwi/wokwi-ci-server-action@v1
2628
- run: hatch run dev:pytest
29+
if: env.WOKWI_CLI_TOKEN != ''
2730
env:
2831
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}

src/wokwi_client/client.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
import base64
66
from pathlib import Path
7-
from typing import Any, Optional, Union
7+
from typing import Any, Optional, Union, cast
88

9+
from wokwi_client.exceptions import ProtocolError
910
from wokwi_client.framebuffer import (
1011
read_framebuffer_png_bytes,
1112
save_framebuffer_png,
@@ -256,9 +257,17 @@ async def listen_pin(self, part: str, pin: str, listen: bool = True) -> Response
256257
"""
257258
return await pin_listen(self._transport, part=part, pin=pin, listen=listen)
258259

259-
async def gpio_list(self) -> ResponseMessage:
260-
"""Get a list of all GPIO pins available in the simulation."""
261-
return await gpio_list(self._transport)
260+
async def gpio_list(self) -> list[str]:
261+
"""Get a list of all GPIO pins available in the simulation.
262+
263+
Returns:
264+
list[str]: Example: ["esp32:GPIO0", "esp32:GPIO1", ...]
265+
"""
266+
resp = await gpio_list(self._transport)
267+
pins_val: Any = resp.get("result", {}).get("pins")
268+
if not isinstance(pins_val, list) or not all(isinstance(p, str) for p in pins_val):
269+
raise ProtocolError("Malformed gpio:list response: expected result.pins: list[str]")
270+
return cast(list[str], pins_val)
262271

263272
async def set_control(
264273
self, part: str, control: str, value: Union[int, bool, float]

0 commit comments

Comments
 (0)