Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 372ba6a

Browse files
Migrate to wokwi-py-client (update pytest-embedded and esptool) (#11863)
* change(requirements): Update pytest-embedded packages to version 2.0.0a1 and esptool to 5.1.0 * change(workflow): Remove extra index URL from pip install command in Wokwi tests - for testing * change(tests): Simplify Wokwi test script arguments and remove timeout variable * change(requirements): Update pytest-embedded packages to version 2.0.0 * Revert "change(workflow): Remove extra index URL from pip install command in Wokwi tests - for testing" This reverts commit 349922c.
1 parent ef453a5 commit 372ba6a

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed

‎.github/scripts/tests_run.sh‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ function run_test {
8888
fi
8989

9090
if [ $platform == "wokwi" ]; then
91-
extra_args=("--target" "$target" "--embedded-services" "arduino,wokwi" "--wokwi-timeout=$wokwi_timeout")
92-
if [[ -f "$sketchdir/scenario.yaml" ]]; then
93-
extra_args+=("--wokwi-scenario" "$sketchdir/scenario.yaml")
94-
fi
91+
extra_args=("--target" "$target" "--embedded-services" "arduino,wokwi")
9592
if [[ -f "$sketchdir/diagram.$target.json" ]]; then
9693
extra_args+=("--wokwi-diagram" "$sketchdir/diagram.$target.json")
9794
fi
@@ -137,7 +134,6 @@ SCRIPTS_DIR="./.github/scripts"
137134
COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count"
138135

139136
platform="hardware"
140-
wokwi_timeout=60000
141137
chunk_run=0
142138
options=0
143139
erase=0
@@ -156,7 +152,6 @@ while [ -n "1ドル" ]; do
156152
;;
157153
-W )
158154
shift
159-
wokwi_timeout=1ドル
160155
if [[ -z $WOKWI_CLI_TOKEN ]]; then
161156
echo "Wokwi CLI token is not set"
162157
exit 1

‎.github/workflows/tests_wokwi.yml‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ on:
1010
permissions:
1111
contents: read
1212

13-
env:
14-
WOKWI_TIMEOUT: 600000 # Milliseconds
15-
1613
jobs:
1714
get-artifacts:
1815
name: Get required artifacts
@@ -271,10 +268,6 @@ jobs:
271268
pip install -U pip
272269
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
273270
274-
- name: Install Wokwi CLI
275-
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
276-
run: curl -L https://wokwi.com/ci/install.sh | sh
277-
278271
- name: Wokwi CI Server
279272
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
280273
uses: wokwi/wokwi-ci-server-action@a6fabb5a49e080158c7a1d121ea5b789536a82c3 # v1
@@ -294,7 +287,7 @@ jobs:
294287
env:
295288
WOKWI_CLI_TOKEN: ${{ secrets.WOKWI_CLI_TOKEN }}
296289
run: |
297-
bash .github/scripts/tests_run.sh -c -type ${{ matrix.type }} -t ${{ matrix.chip }} -i 0 -m 1 -W ${{ env.WOKWI_TIMEOUT }}
290+
bash .github/scripts/tests_run.sh -c -type ${{ matrix.type }} -t ${{ matrix.chip }} -i 0 -m 1 -W
298291
299292
- name: Upload ${{ matrix.chip }} ${{ matrix.type }} Wokwi results as cache
300293
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3

‎docs/en/contributing.rst‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,15 @@ After the test is finished, you can check the output in the terminal and the gen
365365
Additionally, for performance tests, you can check the generated JSON file in the same folder.
366366

367367
You can also run the tests in `Wokwi <https://docs.wokwi.com/>`_ or `Espressif's QEMU <https://github.com/espressif/esp-toolchain-docs/tree/main/qemu>`_
368-
by using the ``-W <timeout_in_ms>`` and ``-Q`` flags respectively. You will need to have the Wokwi and/or QEMU installed in your system
368+
by using the ``-W`` and ``-Q`` flags respectively. You will need to have the Wokwi and/or QEMU installed in your system
369369
and set the ``WOKWI_CLI_TOKEN`` and/or ``QEMU_PATH`` environment variables. The ``WOKWI_CLI_TOKEN`` is the CI token that can be obtained from the
370370
`Wokwi website <https://wokwi.com/dashboard/ci>`_ and the ``QEMU_PATH`` is the path to the QEMU binary.
371371

372372
For example, to run the ``uart`` test using Wokwi, you would run:
373373

374374
.. code-block:: bash
375375
376-
WOKWI_CLI_TOKEN=<your_wokwi_token> ./.github/scripts/tests_run.sh -s uart -t esp32c3 -W<timeout_in_ms>
376+
WOKWI_CLI_TOKEN=<your_wokwi_token> ./.github/scripts/tests_run.sh -s uart -t esp32c3 -W
377377
378378
And to run the ``uart`` test using QEMU, you would run:
379379

@@ -398,7 +398,6 @@ A test suite contains the following files:
398398
* ``<test_name>.ino``: The sketch that will be tested. Required.
399399
* ``ci.json``: The file that specifies how the test suite will be run in the CI system. Optional.
400400
* ``diagram.<target>.json``: The diagram file that specifies the connections between the components in Wokwi. Optional.
401-
* ``scenario.yaml``: The scenario file that specifies how Wokwi will interact with the components. Optional.
402401
* Any other files that are needed for the test suite.
403402

404403
You can read more about the test python API in the `pytest-embedded documentation <https://docs.espressif.com/projects/pytest-embedded/en/latest/usages/expecting.html>`_.

‎tests/requirements.txt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cryptography==44.0.1
22
--only-binary cryptography
33
pytest-cov==5.0.0
4-
pytest-embedded-serial-esp==1.12.0
5-
pytest-embedded-arduino==1.12.0
6-
pytest-embedded-wokwi==1.12.0
7-
pytest-embedded-qemu==1.12.0
8-
esptool==4.8.1
4+
pytest-embedded-serial-esp==2.0.0
5+
pytest-embedded-arduino==2.0.0
6+
pytest-embedded-wokwi==2.0.0
7+
pytest-embedded-qemu==2.0.0
8+
esptool==5.1.0

‎tests/validation/gpio/test_gpio.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import logging
2+
from pytest_embedded_wokwi import Wokwi
3+
from pytest_embedded import Dut
24

35

4-
def test_gpio(dut):
6+
def test_gpio(dut: Dut, wokwi: Wokwi):
57
LOGGER = logging.getLogger(__name__)
68

9+
LOGGER.info("Waiting for Button test begin...")
710
dut.expect_exact("Button test")
811

9-
LOGGER.info("Expecting button press 1")
10-
dut.expect_exact("Button pressed 1 times")
12+
for i in range(3):
13+
LOGGER.info(f"Setting button pressed for {i + 1} seconds")
14+
wokwi.client.set_control("btn1", "pressed", 1)
1115

12-
LOGGER.info("Expecting button press 2")
13-
dut.expect_exact("Button pressed 2 times")
14-
15-
LOGGER.info("Expecting button press 3")
16-
dut.expect_exact("Button pressed 3 times")
16+
dut.expect_exact(f"Button pressed {i + 1} times")
17+
wokwi.client.set_control("btn1", "pressed", 0)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /