Skip to content

Conversation

JakubAndrysek
Copy link
Contributor

This pull request migrates the Wokwi integration in pytest-embedded-wokwi from a CLI-based approach (wokwi-cli) to a new synchronous Python client (wokwi-python-client). It removes all dependencies and code related to the CLI, introduces a new Wokwi class for simulation control, and updates documentation and dependencies accordingly. The changes also update all relevant imports and interfaces in the codebase to use the new Wokwi class, and improve the documentation with usage examples for the new API.

@JakubAndrysek
Copy link
Contributor Author

But the rest code seems to be working

@github-actions github-actions bot changed the title refactor: replace WokwiCLI with Wokwi class refactor: replace WokwiCLI with Wokwi class (RDT-1428) Aug 13, 2025
@hfudev
Copy link
Member

hfudev commented Aug 14, 2025

this looks like a huge improvement! could close #233 as well

@JakubAndrysek
Copy link
Contributor Author

I have looked at the tests, and they have not worked successfully for a long time. Can I do something to fix them, or do they need bigger changes?

@hfudev
Copy link
Member

hfudev commented Aug 15, 2025

@JakubAndrysek you don't need to worry about the test cases. the wokwi test cases are not running anyway.

seems like the runner is failing... I'll take care of those.

@JakubAndrysek
Copy link
Contributor Author

JakubAndrysek commented Aug 28, 2025

Hi, the PR is ready. Please review it, thanks!
(today - added just logging comment)

@hfudev
Copy link
Member

hfudev commented Sep 4, 2025

Please remove the marker here:
https://github.com/espressif/pytest-embedded/blob/a90b0d0c35a8e1c6896130e23c46cedee48b4158/pytest-embedded-wokwi/tests/test_wokwi.py#L6-L10

since the CLI is not required.

I removed the marker and set WOKWI_CLI_TOKEN, but the tests no longer pass. You can try reproducing this locally. in CI, WOKWI_CLI_TOKEN is not set.

I’m fine with the API breaking change, as wokwi is mainly used in development, but please ensure compatibility with the existing test scripts.

@JakubAndrysek
Copy link
Contributor Author

I have found the unimplemented feature in the client, so I have added support for uploading firmware for esp-idf through the flasher_args.json config.
I have submitted a PR with the implementation to the Wokwi Python Client repository.
The tests may have passed in the new release version of the client (v 0.1.3), still waiting for the PR to be merged.

@JakubAndrysek
Copy link
Contributor Author

I have also tested the CI, but it is configured for Python version 3.7, whereas the Wokwi client needs Python 3.9.
image

@JakubAndrysek
Copy link
Contributor Author

Tests do not work for me also on master, I have fixed it using ln -s hello_world_arduino.ino.bin hello_world_arduino.ino.merged.bin called in tests/fixtures/hello_world_arduino/build. Because Arduino uses this path resolver:

​def resolve_firmware(self, app: 'ArduinoApp'):
        # get path of ino.bin file
        return Path(app.binary_path, app.sketch + '.ino.merged.bin')

Fixed in commit e5cb868 (#365)

@hfudev
Copy link
Member

hfudev commented Sep 5, 2025

Wokwi client needs Python 3.9.

probably this PR has to be released with pytest-embedded 2.x then...

we're planning to release a 2.x version that supports python >=3.10

@hfudev
Copy link
Member

hfudev commented Sep 10, 2025

Hi @JakubAndrysek now the main branch is unlocked. could you help resolve the conflicts and I'll merge this PR today?

@JakubAndrysek
Copy link
Contributor Author

Hi, I have fixed Toml deps and added the updated branch to the main. Tests are running perfectly on my side.

@hfudev
Copy link
Member

hfudev commented Sep 10, 2025

Thank you so much. I'll merge it today and make a dev release

@JakubAndrysek
Copy link
Contributor Author

Will it be possible to add a new CI action which will run all pytest in GitHub Action, also in the forked repo? Currently, there is a custom runner in the Esprrssif infrastructure. Some tests, like serial, will be disabled in the GitHub runner, but for example, the Wokwi might be tested.

@hfudev
Copy link
Member

hfudev commented Sep 10, 2025

I'll enable the wokwi tests in ci.

@hfudev hfudev merged commit 3ab494f into espressif:main Sep 10, 2025
4 of 5 checks passed
@hfudev
Copy link
Member

hfudev commented Sep 10, 2025

oh... forgot to ask you to squash the commit history...

no worries, let's improve it next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants