forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pytest: use case_tester for multi-device tests
- Loading branch information
Showing
3 changed files
with
19 additions
and
38 deletions.
There are no files selected for viewing
26 changes: 2 additions & 24 deletions
26
components/esp_wifi/test_apps/wifi_connect/pytest_wifi_connect.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: Unlicense OR CC0-1.0 | ||
|
||
from typing import Tuple | ||
|
||
import pytest | ||
from pytest_embedded_idf.dut import IdfDut | ||
|
||
|
||
def multi_device_case_run(dut: Tuple[IdfDut, IdfDut], test_case: str, sub_cases: list, timeout: int) -> None: | ||
dut_num = len(sub_cases) | ||
# start | ||
for i in range(dut_num): | ||
dut[i].write(f'"{test_case}"') | ||
for i in range(dut_num): | ||
dut[i].expect(r'\t\(2\)\s+\".+\"') | ||
for i in range(dut_num): | ||
dut[i].write(f'{i+1}') | ||
# end | ||
for i in range(dut_num): | ||
dut[i].expect_unity_test_output(timeout=timeout) | ||
dut[i].expect_exact("Enter next test, or 'enter' to see menu") | ||
|
||
|
||
@pytest.mark.esp32 | ||
@pytest.mark.esp32c3 | ||
@pytest.mark.wifi_two_dut | ||
@pytest.mark.parametrize('count', [2], indirect=True) | ||
def test_wifi_connect_cases(dut: Tuple[IdfDut, IdfDut]) -> None: | ||
test_menu = dut[0].parse_test_menu() | ||
dut[1].expect_exact('Press ENTER to see the list of tests') | ||
for test_case in test_menu: | ||
timeout = int(test_case.attributes.get('timeout', 60)) | ||
multi_device_case_run(dut, test_case.name, test_case.subcases, timeout) | ||
def test_wifi_connect_cases(case_tester) -> None: # type: ignore | ||
case_tester.run_all_cases() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters