mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
test: add pytest_wifi_getting_started script
This commit is contained in:
parent
511ccdcb70
commit
52b5a8348e
@ -111,6 +111,16 @@ example_test_pytest_esp32_flash_encryption:
|
|||||||
TARGET: ESP32
|
TARGET: ESP32
|
||||||
ENV_MARKER: flash_encryption
|
ENV_MARKER: flash_encryption
|
||||||
|
|
||||||
|
example_test_pytest_esp32_multi_dut_generic:
|
||||||
|
extends:
|
||||||
|
- .pytest_examples_dir_template
|
||||||
|
- .rules:test:example_test-esp32
|
||||||
|
needs:
|
||||||
|
- build_pytest_examples_esp32
|
||||||
|
variables:
|
||||||
|
TARGET: ESP32
|
||||||
|
ENV_MARKER: multi_dut_generic
|
||||||
|
|
||||||
example_test_pytest_esp32c3_flash_encryption:
|
example_test_pytest_esp32c3_flash_encryption:
|
||||||
extends:
|
extends:
|
||||||
- .pytest_examples_dir_template
|
- .pytest_examples_dir_template
|
||||||
|
42
examples/wifi/getting_started/pytest_wifi_getting_started.py
Normal file
42
examples/wifi/getting_started/pytest_wifi_getting_started.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytest_embedded_idf.dut import IdfDut
|
||||||
|
|
||||||
|
# @pytest.mark.supported_targets
|
||||||
|
# This test should support all targets, even between different target types
|
||||||
|
# For now our CI only support multi dut with esp32
|
||||||
|
# If you want to enable different target type, please use the following param
|
||||||
|
# @pytest.mark.parametrize(
|
||||||
|
# 'count, app_path, target', [
|
||||||
|
# (2,
|
||||||
|
# f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}',
|
||||||
|
# 'esp32|esp32s2'),
|
||||||
|
# ],
|
||||||
|
# indirect=True,
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.esp32
|
||||||
|
@pytest.mark.multi_dut_generic
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'count, app_path', [
|
||||||
|
(2,
|
||||||
|
f'{os.path.join(os.path.dirname(__file__), "softAP")}|{os.path.join(os.path.dirname(__file__), "station")}'),
|
||||||
|
], indirect=True
|
||||||
|
)
|
||||||
|
def test_wifi_getting_started(dut: Tuple[IdfDut, IdfDut]) -> None:
|
||||||
|
softap = dut[0]
|
||||||
|
station = dut[1]
|
||||||
|
|
||||||
|
ssid = 'myssid'
|
||||||
|
password = 'mypassword'
|
||||||
|
tag = 'wifi station'
|
||||||
|
|
||||||
|
station.expect(f'{tag}: got ip:', timeout=60)
|
||||||
|
station.expect(f'{tag}: connected to ap SSID:{ssid} password:{password}', timeout=60)
|
||||||
|
softap.expect('station .+ join, AID=', timeout=60)
|
@ -35,6 +35,9 @@ markers =
|
|||||||
flash_encryption: Flash Encryption runners
|
flash_encryption: Flash Encryption runners
|
||||||
ir_transceiver: runners with a pair of IR transmitter and receiver
|
ir_transceiver: runners with a pair of IR transmitter and receiver
|
||||||
|
|
||||||
|
## multi-dut markers
|
||||||
|
multi_dut_generic: tests should be run on generic runners, at least have two duts connected.
|
||||||
|
|
||||||
# log related
|
# log related
|
||||||
log_cli = True
|
log_cli = True
|
||||||
log_cli_level = INFO
|
log_cli_level = INFO
|
||||||
|
@ -117,12 +117,13 @@ def is_in_directory(file_path: str, folder: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def to_list(s: Any) -> List[Any]:
|
def to_list(s: Any) -> List[Any]:
|
||||||
if isinstance(s, set) or isinstance(s, tuple):
|
if isinstance(s, (set, tuple)):
|
||||||
return list(s)
|
return list(s)
|
||||||
elif isinstance(s, list):
|
|
||||||
|
if isinstance(s, list):
|
||||||
return s
|
return s
|
||||||
else:
|
|
||||||
return [s]
|
return [s]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
Loading…
Reference in New Issue
Block a user