mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 11:03:05 +00:00
fe57fa6cf1
- Add pytest_unit_test_app.py with per-group test functions (each gets a fresh QEMU boot to handle the single esp_matter::start() constraint) - Add build_unit_test_app_qemu and pytest_unit_test_app_qemu CI jobs - Disable WiFi and use QEMU virtual Ethernet in sdkconfig.defaults - Register host_test and qemu pytest markers - Document local QEMU test setup in README
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import pytest
|
|
from pytest_embedded_qemu.dut import QemuDut
|
|
|
|
|
|
def run_group(dut: QemuDut, group: str, timeout: int = 120) -> None:
|
|
"""Run all Unity cases matching a group tag, then verify no failures.
|
|
|
|
pytest-embedded records Unity results without raising on failure,
|
|
so we check dut.testsuite afterwards to surface failures to pytest.
|
|
"""
|
|
cases = [c for c in dut.test_menu if group in c.groups]
|
|
assert cases, f'No cases for group "{group}" (parsed {len(dut.test_menu)} total)'
|
|
|
|
dut.run_all_single_board_cases(group=group, timeout=timeout)
|
|
|
|
failed = dut.testsuite.failed_cases
|
|
if failed:
|
|
names = [tc.name for tc in failed]
|
|
pytest.fail(f'{len(failed)} failed in [{group}]: {", ".join(names)}')
|
|
|
|
|
|
@pytest.mark.host_test
|
|
@pytest.mark.qemu
|
|
@pytest.mark.esp32c3
|
|
def test_get_val(dut: QemuDut) -> None:
|
|
run_group(dut, 'get_val')
|
|
|
|
|
|
@pytest.mark.host_test
|
|
@pytest.mark.qemu
|
|
@pytest.mark.esp32c3
|
|
def test_get_val_type(dut: QemuDut) -> None:
|
|
run_group(dut, 'get_val_type')
|
|
|
|
|
|
@pytest.mark.host_test
|
|
@pytest.mark.qemu
|
|
@pytest.mark.esp32c3
|
|
def test_update_report(dut: QemuDut) -> None:
|
|
run_group(dut, 'report')
|
|
run_group(dut, 'update')
|