{"id":14963036,"url":"https://github.com/espressif/pytest-embedded","last_synced_at":"2025-05-15T18:07:52.827Z","repository":{"id":38341541,"uuid":"374549882","full_name":"espressif/pytest-embedded","owner":"espressif","description":"A pytest plugin that designed for embedded testing","archived":false,"fork":false,"pushed_at":"2025-04-28T18:21:34.000Z","size":12998,"stargazers_count":105,"open_issues_count":23,"forks_count":29,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-05T08:41:41.019Z","etag":null,"topics":["embedded","pytest","testing"],"latest_commit_sha":null,"homepage":"https://docs.espressif.com/projects/pytest-embedded/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/espressif.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-07T05:51:33.000Z","updated_at":"2025-04-30T11:25:17.000Z","dependencies_parsed_at":"2023-02-19T04:01:02.791Z","dependency_job_id":"51c5a95a-0a37-4911-850d-d049fc66044f","html_url":"https://github.com/espressif/pytest-embedded","commit_stats":{"total_commits":662,"total_committers":21,"mean_commits":"31.523809523809526","dds":"0.14199395770392753","last_synced_commit":"256746f03afe41793e219c9ee59ca858c61b792e"},"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fpytest-embedded","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fpytest-embedded/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fpytest-embedded/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espressif%2Fpytest-embedded/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/espressif","download_url":"https://codeload.github.com/espressif/pytest-embedded/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253534797,"owners_count":21923544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded","pytest","testing"],"created_at":"2024-09-24T13:30:56.421Z","updated_at":"2025-05-15T18:07:52.804Z","avatar_url":"https://github.com/espressif.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytest-embedded\n\n[![Documentation Status](https://readthedocs.com/projects/espressif-pytest-embedded/badge/?version=latest)](https://docs.espressif.com/projects/pytest-embedded/en/latest/?badge=latest) ![Python 3.7+](https://img.shields.io/pypi/pyversions/pytest-embedded)\n\nA pytest plugin that has multiple services available for various functionalities. Designed for embedded testing.\n\n## Installation\n\n[![pytest-embedded](https://img.shields.io/pypi/v/pytest-embedded?color=green\u0026label=pytest-embedded)](https://pypi.org/project/pytest-embedded/)\n[![pytest-embedded-serial](https://img.shields.io/pypi/v/pytest-embedded-serial?color=green\u0026label=pytest-embedded-serial)](https://pypi.org/project/pytest-embedded-serial/)\n[![pytest-embedded-serial-esp](https://img.shields.io/pypi/v/pytest-embedded-serial-esp?color=green\u0026label=pytest-embedded-serial-esp)](https://pypi.org/project/pytest-embedded-serial-esp/)\n[![pytest-embedded-idf](https://img.shields.io/pypi/v/pytest-embedded-idf?color=green\u0026label=pytest-embedded-idf)](https://pypi.org/project/pytest-embedded-idf/)\n[![pytest-embedded-qemu](https://img.shields.io/pypi/v/pytest-embedded-qemu?color=green\u0026label=pytest-embedded-qemu)](https://pypi.org/project/pytest-embedded-qemu/)\n[![pytest-embedded-arduino](https://img.shields.io/pypi/v/pytest-embedded-arduino?color=green\u0026label=pytest-embedded-arduino)](https://pypi.org/project/pytest-embedded-arduino/)\n[![pytest-embedded-wokwi](https://img.shields.io/pypi/v/pytest-embedded-wokwi?color=green\u0026label=pytest-embedded-wokwi)](https://pypi.org/project/pytest-embedded-wokwi/)\n[![pytest-embedded-nuttx](https://img.shields.io/pypi/v/pytest-embedded-nuttx?color=green\u0026label=pytest-embedded-nuttx)](https://pypi.org/project/pytest-embedded-nuttx/)\n\nPackages under this repo mainly use semantic versioning. Sometimes a bug fix version may contain some non-breaking new features as well.\n\nIt is recommended to use `~=1.0` to get rid of breaking changes, and use the latest new features. For example,\n\n```shell\npip install -U pytest-embedded~=1.0\n```\n\n## Quickstart\n\n- `pip install -U pytest-embedded~=1.0`\n- Create a file `test_basic.py`\n\n```python\nfrom pytest_embedded import Dut\n\n\ndef test_basic_expect(redirect, dut: Dut):\n    with redirect():\n        print('this would be redirected')\n\n    dut.expect('this')\n    dut.expect_exact('would')\n    dut.expect('[be]{2}')\n    dut.expect_exact('redirected')\n```\n\n- Run the test with `pytest`, the result would be like:\n\n```shell\ncollected 1 item\n\ntest_basic.py .                                                        [100%]\n\n============================= 1 passed in 0.01s =============================\n```\n\n- if run with `pytest -s`, the output would be as follows:\n\n```shell\ncollected 1 item\n\ntest_basic.py 2022-01-01 12:34:56 this would be redirected\n.\n\n============================= 1 passed in 0.01s =============================\n```\n\nThe `print` line is also duplicated to console output.\n\n## Extra Services\n\nYou can activate more services with `pytest --embedded-services service[,service]` to enable extra fixtures and functionalities. These services are provided by several optional dependencies. You can install them via `pip` as well.\n\nAvailable services:\n\n- `serial`: serial port utilities.\n- `esp`: auto-detect target/port by [esptool](https://github.com/espressif/esptool).\n- `idf`: auto-detect more app info with [ESP-IDF](https://github.com/espressif/esp-idf) specific rules, auto-flash the binary into the target.\n- `jtag`: openocd/gdb utilities\n- `qemu`: running test cases on QEMU instead of the real target.\n- `arduino`: auto-detect more app info with [arduino](https://github.com/arduino/Arduino) specific rules, auto-flash the binary into the target.\n- `wokwi`: running test cases with [Wokwi](https://wokwi.com/) instead of the real target.\n- `nuttx`: service for [nuttx](https://nuttx.apache.org/) project, optionally with espressif devices.\n\n## Resources\n\n- Documentation is hosted at [https://docs.espressif.com/projects/pytest-embedded/en/latest/](https://docs.espressif.com/projects/pytest-embedded/en/latest/)\n- More examples under [examples](https://github.com/espressif/pytest-embedded/tree/main/examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespressif%2Fpytest-embedded","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fespressif%2Fpytest-embedded","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespressif%2Fpytest-embedded/lists"}