test: format all test scripts

This commit is contained in:
Evgeny Torbin
2026-04-17 16:01:00 +02:00
committed by Fu Hanxi
parent 1740554ae3
commit 59f62ad15f
349 changed files with 4844 additions and 3464 deletions
@@ -1,19 +1,22 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import socket
import pytest
from common_test_methods import (get_env_config_variable, get_host_ip4_by_dest_ip, get_host_ip6_by_dest_ip,
get_my_interface_by_dest_ip)
from common_test_methods import get_env_config_variable
from common_test_methods import get_host_ip4_by_dest_ip
from common_test_methods import get_host_ip6_by_dest_ip
from common_test_methods import get_my_interface_by_dest_ip
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
try:
from run_tcp_server import TcpServer
except ImportError:
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')))
from run_tcp_server import TcpServer
@@ -21,13 +24,8 @@ except ImportError:
PORT = 3333
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_tcp_client_ipv4(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -48,13 +46,8 @@ def test_examples_tcp_client_ipv4(dut: Dut) -> None:
dut.expect('OK: Message from ESP32')
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_tcp_client_ipv6(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -1,19 +1,21 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import time
import netifaces
import pytest
from common_test_methods import get_env_config_variable, get_my_interface_by_dest_ip
from common_test_methods import get_env_config_variable
from common_test_methods import get_my_interface_by_dest_ip
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
try:
from run_tcp_client import tcp_client
except ImportError:
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')))
from run_tcp_client import tcp_client
@@ -22,13 +24,8 @@ PORT = 3333
MESSAGE = 'Data to ESP'
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_tcp_server_ipv4(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -49,14 +46,16 @@ def test_examples_tcp_server_ipv4(dut: Dut) -> None:
dut.expect(MESSAGE)
@pytest.mark.esp32c2
@pytest.mark.wifi_router
@pytest.mark.xtal_26mhz
@pytest.mark.parametrize(
'config, baud', [
'config, baud',
[
('c2_xtal26m', '74880'),
], indirect=True
],
indirect=True,
)
@idf_parametrize('target', ['esp32c2'], indirect=['target'])
def test_examples_tcp_server_ipv4_esp32c2_26mhz(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -77,13 +76,8 @@ def test_examples_tcp_server_ipv4_esp32c2_26mhz(dut: Dut) -> None:
dut.expect(MESSAGE)
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_tcp_server_ipv6(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -108,13 +102,8 @@ def test_examples_tcp_server_ipv6(dut: Dut) -> None:
dut.expect(MESSAGE)
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_tcp_server_ipv6_only(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -1,20 +1,23 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import socket
import pytest
from common_test_methods import (get_env_config_variable, get_host_ip4_by_dest_ip, get_host_ip6_by_dest_ip,
get_my_interface_by_dest_ip)
from common_test_methods import get_env_config_variable
from common_test_methods import get_host_ip4_by_dest_ip
from common_test_methods import get_host_ip6_by_dest_ip
from common_test_methods import get_my_interface_by_dest_ip
from pexpect.exceptions import TIMEOUT
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
try:
from run_udp_server import UdpServer
except ImportError:
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')))
from run_udp_server import UdpServer
@@ -23,13 +26,8 @@ PORT = 3333
MAX_RETRIES = 3
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_udp_client_ipv4(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -57,13 +55,8 @@ def test_examples_udp_client_ipv4(dut: Dut) -> None:
raise ValueError('Failed to send/recv udp packets.')
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_udp_client_ipv6(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -1,17 +1,19 @@
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import pytest
from common_test_methods import get_env_config_variable, get_my_interface_by_dest_ip
from common_test_methods import get_env_config_variable
from common_test_methods import get_my_interface_by_dest_ip
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
try:
from run_udp_client import udp_client
except ImportError:
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')))
from run_udp_client import udp_client
@@ -21,13 +23,8 @@ MESSAGE = 'Data to ESP'
MAX_RETRIES = 3
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_udp_server_ipv4(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')
@@ -52,13 +49,8 @@ def test_examples_udp_server_ipv4(dut: Dut) -> None:
dut.expect(MESSAGE)
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.wifi_router
@idf_parametrize('target', ['esp32', 'esp32s2', 'esp32c2', 'esp32c3', 'esp32s3', 'esp32c6'], indirect=['target'])
def test_examples_udp_server_ipv6(dut: Dut) -> None:
# Parse IP address of STA
logging.info('Waiting to connect with AP')