diff --git a/components/esp_driver_tsens/test_apps/temperature_sensor/pytest_temperature_sensor.py b/components/esp_driver_tsens/test_apps/temperature_sensor/pytest_temperature_sensor.py index c5880f8058..fb7d2fcec8 100644 --- a/components/esp_driver_tsens/test_apps/temperature_sensor/pytest_temperature_sensor.py +++ b/components/esp_driver_tsens/test_apps/temperature_sensor/pytest_temperature_sensor.py @@ -36,10 +36,10 @@ def test_temperature_sensor_cbs(dut: Dut) -> None: dut.run_all_single_board_cases() -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize('count', [2], indirect=True) @idf_parametrize('target', ['esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6', 'esp32c61'], indirect=['target']) def test_temperature_phy_cases(case_tester: CaseTester) -> None: # type: ignore for case in case_tester.test_menu: - if case.attributes.get('test_env', 'wifi_two_dut') == 'wifi_two_dut': + if case.attributes.get('test_env', 'two_duts') == 'two_duts': case_tester.run_all_multi_dev_cases(case=case, reset=True) diff --git a/components/esp_wifi/test_apps/bin_size_apsta/pytest_bin_size_apsta.py b/components/esp_wifi/test_apps/bin_size_apsta/pytest_bin_size_apsta.py index 0aafd1c7eb..61dc0a1b92 100644 --- a/components/esp_wifi/test_apps/bin_size_apsta/pytest_bin_size_apsta.py +++ b/components/esp_wifi/test_apps/bin_size_apsta/pytest_bin_size_apsta.py @@ -40,7 +40,7 @@ def _get_diff_th( return diff_threshold.get(target) or diff_threshold['default'] -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, config, skip_autoflash', [ diff --git a/components/esp_wifi/test_apps/wifi_connect/pytest_wifi_connect.py b/components/esp_wifi/test_apps/wifi_connect/pytest_wifi_connect.py index e4b87e35d3..60d6d8c358 100644 --- a/components/esp_wifi/test_apps/wifi_connect/pytest_wifi_connect.py +++ b/components/esp_wifi/test_apps/wifi_connect/pytest_wifi_connect.py @@ -5,7 +5,7 @@ from pytest_embedded_idf.unity_tester import CaseTester from pytest_embedded_idf.utils import idf_parametrize -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize('count', [2], indirect=True) @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32s2', 'esp32s3', 'esp32c5', 'esp32c6', 'esp32c61'], indirect=['target'] @@ -14,7 +14,7 @@ def test_wifi_connect_cases(case_tester: CaseTester) -> None: # type: ignore case_tester.run_all_cases() -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud', @@ -29,7 +29,7 @@ def test_wifi_connect_cases_esp32c2_xtal26m(case_tester: CaseTester) -> None: @pytest.mark.esp32c2eco4 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud', @@ -43,7 +43,7 @@ def test_wifi_connect_cases_esp32c2eco4_xtal26m(case_tester: CaseTester) -> None case_tester.run_all_cases() -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.esp32c3eco7 @pytest.mark.parametrize( 'count, config', diff --git a/components/esp_wifi/test_apps/wifi_nvs_config/pytest_wifi_nvs_connect.py b/components/esp_wifi/test_apps/wifi_nvs_config/pytest_wifi_nvs_connect.py index d8c1b8098b..9756f9fa33 100644 --- a/components/esp_wifi/test_apps/wifi_nvs_config/pytest_wifi_nvs_connect.py +++ b/components/esp_wifi/test_apps/wifi_nvs_config/pytest_wifi_nvs_connect.py @@ -5,7 +5,7 @@ from pytest_embedded_idf.unity_tester import CaseTester from pytest_embedded_idf.utils import idf_parametrize -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize('count', [2], indirect=True) @idf_parametrize( 'target', @@ -16,7 +16,7 @@ def test_wifi_nvs_connect_cases(case_tester: CaseTester) -> None: # type: ignor case_tester.run_all_cases() -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud', diff --git a/components/wpa_supplicant/test_apps/main/test_offchannel.c b/components/wpa_supplicant/test_apps/main/test_offchannel.c index 0f73079e3b..6ccb9b843a 100644 --- a/components/wpa_supplicant/test_apps/main/test_offchannel.c +++ b/components/wpa_supplicant/test_apps/main/test_offchannel.c @@ -265,4 +265,4 @@ static void test_wifi_roc(void) } } -TEST_CASE_MULTIPLE_DEVICES("test ROC and Offchannel Action Frame Tx", "[Offchan][test_env=wifi_two_dut][timeout=90]", test_wifi_roc, test_wifi_offchan_tx); +TEST_CASE_MULTIPLE_DEVICES("test ROC and Offchannel Action Frame Tx", "[Offchan][test_env=two_duts][timeout=90]", test_wifi_roc, test_wifi_offchan_tx); diff --git a/components/wpa_supplicant/test_apps/main/test_wifi_external_bss.c b/components/wpa_supplicant/test_apps/main/test_wifi_external_bss.c index df75beba46..2bc994c8fc 100644 --- a/components/wpa_supplicant/test_apps/main/test_wifi_external_bss.c +++ b/components/wpa_supplicant/test_apps/main/test_wifi_external_bss.c @@ -198,6 +198,6 @@ static void test_softap_connection(void) } /* Test that wifi starts, scans and stops normally when .bss segment is allowed to move to external memory */ -TEST_CASE_MULTIPLE_DEVICES("test wifi connection for sta and softap when ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY is enabled", "[esp_wifi][test_env=wifi_two_dut]", test_station_connection, test_softap_connection); +TEST_CASE_MULTIPLE_DEVICES("test wifi connection for sta and softap when ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY is enabled", "[esp_wifi][test_env=two_duts]", test_station_connection, test_softap_connection); #endif // CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY diff --git a/components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py b/components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py index c8633f1fda..e7ff601bfa 100644 --- a/components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py +++ b/components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py @@ -16,7 +16,7 @@ def test_wpa_supplicant_ut(dut: Dut) -> None: dut.run_all_single_board_cases() -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count', [ @@ -31,12 +31,12 @@ def test_wpa_supplicant_ut(dut: Dut) -> None: ) def test_wpa_supplicant_ut_offchan(case_tester: CaseTester) -> None: for case in case_tester.test_menu: - if case.attributes.get('test_env') == 'wifi_two_dut': + if case.attributes.get('test_env') == 'two_duts': case_tester.run_multi_dev_case(case=case, reset=True) # test when external bss segment is enabled -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, config', [ @@ -50,11 +50,11 @@ def test_wpa_supplicant_ut_offchan(case_tester: CaseTester) -> None: @idf_parametrize('target', ['esp32s3'], indirect=['target']) def test_wpa_supplicant_ut_psram(case_tester: CaseTester) -> None: for case in case_tester.test_menu: - if case.attributes.get('test_env') == 'wifi_two_dut': + if case.attributes.get('test_env') == 'two_duts': case_tester.run_multi_dev_case(case=case, reset=True) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.esp32c2eco4 @pytest.mark.xtal_26mhz @pytest.mark.parametrize( @@ -71,11 +71,11 @@ def test_wpa_supplicant_ut_psram(case_tester: CaseTester) -> None: @idf_parametrize('target', ['esp32c2'], indirect=['target']) def test_wpa_supplicant_esp32c2eco4_xtal26mhz(case_tester: CaseTester) -> None: for case in case_tester.test_menu: - if case.attributes.get('test_env') == 'wifi_two_dut': + if case.attributes.get('test_env') == 'two_duts': case_tester.run_multi_dev_case(case=case, reset=True) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.esp32c3eco7 @pytest.mark.parametrize( 'count, config', @@ -90,5 +90,5 @@ def test_wpa_supplicant_esp32c2eco4_xtal26mhz(case_tester: CaseTester) -> None: @idf_parametrize('target', ['esp32c3'], indirect=['target']) def test_wpa_supplicant_esp32c3eco7(case_tester: CaseTester) -> None: for case in case_tester.test_menu: - if case.attributes.get('test_env') == 'wifi_two_dut': + if case.attributes.get('test_env') == 'two_duts': case_tester.run_multi_dev_case(case=case, reset=True) diff --git a/examples/bluetooth/.build-test-rules.yml b/examples/bluetooth/.build-test-rules.yml index 4217db3a46..93651195db 100644 --- a/examples/bluetooth/.build-test-rules.yml +++ b/examples/bluetooth/.build-test-rules.yml @@ -139,6 +139,8 @@ examples/bluetooth/esp_hid_host: - if: SOC_BT_SUPPORTED != 1 depends_components+: - esp_hid + depends_filepatterns: + - examples/bluetooth/bluedroid/classic_bt/pytest_classic_bt_test.py examples/bluetooth/hci/ble_adv_scan_combined: <<: *bt_default_depends diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/pytest_ble_throughput_test.py b/examples/bluetooth/bluedroid/ble/ble_throughput/pytest_ble_throughput_test.py index a19cb8ed78..afd1169e36 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/pytest_ble_throughput_test.py +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/pytest_ble_throughput_test.py @@ -1,22 +1,23 @@ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 -import os.path import time -from typing import Tuple +from pathlib import Path import pytest from pytest_embedded_idf.dut import IdfDut from pytest_embedded_idf.utils import idf_parametrize + +CUR_DIR = Path(__file__).parent.resolve() + + # Case 1: gatt write throughput test(EXAMPLE_CI_ID = 2) - - -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}', + f'{str(CUR_DIR / "throughput_server")}|{str(CUR_DIR / "throughput_client")}', 'write', 'y', ), @@ -26,7 +27,7 @@ from pytest_embedded_idf.utils import idf_parametrize @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c61', 'esp32c5', 'esp32h2', 'esp32s3'], indirect=['target'] ) -def test_gatt_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_gatt_write_throughput(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( @@ -54,7 +55,7 @@ def test_gatt_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> Non # Case 2: gatt write throughput test for ESP32C2 26mhz xtal(EXAMPLE_CI_ID = 2) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -63,14 +64,14 @@ def test_gatt_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> Non 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}', + f'{str(CUR_DIR / "throughput_server")}|{str(CUR_DIR / "throughput_client")}', 'esp32c2_xtal26m_write', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_write_throughput(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( @@ -98,13 +99,13 @@ def test_c2_26mhz_xtal_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut # Case 3: gatt notify throughput test(EXAMPLE_CI_ID = 1) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}', + f'{str(CUR_DIR / "throughput_server")}|{str(CUR_DIR / "throughput_client")}', 'notify', 'y', ), @@ -114,7 +115,7 @@ def test_c2_26mhz_xtal_write_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c61', 'esp32c5', 'esp32h2', 'esp32s3'], indirect=['target'] ) -def test_gatt_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_gatt_notify_throughput(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( @@ -144,7 +145,7 @@ def test_gatt_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> No # Case 4: gatt notify throughput test for ESP32C2 26mhz xtal(EXAMPLE_CI_ID = 1) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -153,14 +154,14 @@ def test_gatt_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> No 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "throughput_server")}|{os.path.join(os.path.dirname(__file__), "throughput_client")}', + f'{str(CUR_DIR / "throughput_server")}|{str(CUR_DIR / "throughput_client")}', 'esp32c2_xtal26m_notify', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_notify_throughput(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_notify_throughput(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( diff --git a/examples/bluetooth/bluedroid/ble/pytest_ble_test.py b/examples/bluetooth/bluedroid/ble/pytest_ble_test.py index 7ac6ec61fc..4b4224de8f 100644 --- a/examples/bluetooth/bluedroid/ble/pytest_ble_test.py +++ b/examples/bluetooth/bluedroid/ble/pytest_ble_test.py @@ -1,24 +1,25 @@ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 -import os.path -from typing import Tuple +from pathlib import Path import pexpect import pytest from pytest_embedded import Dut from pytest_embedded_idf.dut import IdfDut from pytest_embedded_idf.utils import idf_parametrize + +CUR_DIR = Path(__file__).parent.resolve() + + # Case 1: gatt client and gatt server test # EXAMPLE_CI_ID=3 - - -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}', + f'{str(CUR_DIR / "gatt_server")}|{str(CUR_DIR / "gatt_client")}', 'name', 'y', ), @@ -28,7 +29,7 @@ from pytest_embedded_idf.utils import idf_parametrize @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'] ) -def test_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_gatt_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: gatt_client = dut[1] gatt_server = dut[0] gatt_client_addr = ( @@ -61,7 +62,7 @@ def test_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 2: gatt client and gatt server test for ESP32C2 26mhz xtal # EXAMPLE_CI_ID=3 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -70,14 +71,14 @@ def test_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}', + f'{str(CUR_DIR / "gatt_server")}|{str(CUR_DIR / "gatt_client")}', 'esp32c2_xtal26m', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_gatt_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: gatt_client = dut[1] gatt_server = dut[0] gatt_client_addr = ( @@ -110,13 +111,13 @@ def test_c2_26mhz_xtal_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> N # Case 3: gatt security server and gatt security client test # EXAMPLE_CI_ID=5 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "gatt_security_server")}|{os.path.join(os.path.dirname(__file__), "gatt_security_client")}', + f'{str(CUR_DIR / "gatt_security_server")}|{str(CUR_DIR / "gatt_security_client")}', 'name', 'y', ), @@ -126,7 +127,7 @@ def test_c2_26mhz_xtal_gatt_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> N @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'] ) -def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: Tuple) -> None: +def test_gatt_security_func(app_path: str, dut: tuple[IdfDut, IdfDut], target: tuple) -> None: gatt_security_client = dut[1] gatt_security_server = dut[0] gatt_security_client_addr = ( @@ -143,9 +144,9 @@ def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: T gatt_security_client.expect_exact('Scanning start successfully', timeout=30) gatt_security_client.expect_exact('Device found BE', timeout=30) # can not get rpa_address, so not check server address - gatt_security_client.expect_exact(f'Connected, conn_id 0, remote ', timeout=30) + gatt_security_client.expect_exact('Connected, conn_id 0, remote ', timeout=30) if target == ('esp32', 'esp32'): - gatt_security_server.expect_exact(f'Connected, conn_id 0, remote', timeout=30) + gatt_security_server.expect_exact('Connected, conn_id 0, remote', timeout=30) else: gatt_security_server.expect_exact(f'Connected, conn_id 0, remote {gatt_security_client_addr}', timeout=30) gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_PID', timeout=30) @@ -158,12 +159,12 @@ def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: T gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_LID', timeout=30) gatt_security_server.expect_exact('Key exchanged, key_type ESP_LE_KEY_PID', timeout=30) if target == ('esp32', 'esp32'): - gatt_security_server.expect_exact(f'Authentication complete, addr_type 1, addr ', timeout=30) + gatt_security_server.expect_exact('Authentication complete, addr_type 1, addr ', timeout=30) else: gatt_security_server.expect_exact( f'Authentication complete, addr_type 0, addr {gatt_security_client_addr}', timeout=30 ) - gatt_security_client.expect_exact(f'Authentication complete, addr_type 1, addr ', timeout=30) + gatt_security_client.expect_exact('Authentication complete, addr_type 1, addr ', timeout=30) gatt_security_server.expect_exact('Pairing successfully', timeout=30) gatt_security_server.expect_exact('Bonded devices number 1', timeout=30) gatt_security_client.expect_exact('Pairing successfully', timeout=30) @@ -178,7 +179,7 @@ def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: T # Case 4: gatt security server and gatt security client test for ESP32C2 26mhz xtal # EXAMPLE_CI_ID=5 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -187,14 +188,14 @@ def test_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut], target: T 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "gatt_security_server")}|{os.path.join(os.path.dirname(__file__), "gatt_security_client")}', + f'{str(CUR_DIR / "gatt_security_server")}|{str(CUR_DIR / "gatt_security_client")}', 'esp32c2_xtal26m', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: gatt_security_client = dut[1] gatt_security_server = dut[0] gatt_security_client_addr = ( @@ -211,7 +212,7 @@ def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfD gatt_security_client.expect_exact('Scanning start successfully', timeout=30) gatt_security_client.expect_exact('Device found BE', timeout=30) # can not get rpa_address, so not check server address - gatt_security_client.expect_exact(f'Connected, conn_id 0, remote ', timeout=30) + gatt_security_client.expect_exact('Connected, conn_id 0, remote ', timeout=30) gatt_security_server.expect_exact(f'Connected, conn_id 0, remote {gatt_security_client_addr}', timeout=30) gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_PID', timeout=30) gatt_security_client.expect_exact('Key exchanged, key_type ESP_LE_KEY_LENC', timeout=30) @@ -225,7 +226,7 @@ def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfD gatt_security_server.expect_exact( f'Authentication complete, addr_type 0, addr {gatt_security_client_addr}', timeout=30 ) - gatt_security_client.expect_exact(f'Authentication complete, addr_type 1, addr ', timeout=30) + gatt_security_client.expect_exact('Authentication complete, addr_type 1, addr ', timeout=30) gatt_security_server.expect_exact('Pairing successfully', timeout=30) gatt_security_server.expect_exact('Bonded devices number 1', timeout=30) gatt_security_client.expect_exact('Pairing successfully', timeout=30) @@ -239,13 +240,13 @@ def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfD # Case 5: ble ibeacon test -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}|{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}', + f'{str(CUR_DIR / "ble_ibeacon")}|{str(CUR_DIR / "ble_ibeacon")}', 'sender|receiver', 'y', ), @@ -255,7 +256,7 @@ def test_c2_26mhz_xtal_gatt_security_func(app_path: str, dut: Tuple[IdfDut, IdfD @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'] ) -def test_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_ble_ibeacon_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: ibeacon_sender = dut[0] ibeacon_receiver = dut[1] @@ -277,7 +278,7 @@ def test_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 5: ble ibeacon test for ESP32C2 26mhz xtal -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -286,14 +287,14 @@ def test_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}|{os.path.join(os.path.dirname(__file__), "ble_ibeacon")}', + f'{str(CUR_DIR / "ble_ibeacon")}|{str(CUR_DIR / "ble_ibeacon")}', 'esp32c2_xtal26m_sender|esp32c2_xtal26m_receiver', 'y', ), ], indirect=True, ) -def test_c2_26mhz_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_ble_ibeacon_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: ibeacon_sender = dut[0] ibeacon_receiver = dut[1] @@ -316,13 +317,13 @@ def test_c2_26mhz_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> # Case 6: gatt client and gatt server config test # EXAMPLE_CI_ID=4 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}', + f'{str(CUR_DIR / "gatt_server")}|{str(CUR_DIR / "gatt_client")}', 'cfg_test', 'y', ), @@ -332,7 +333,7 @@ def test_c2_26mhz_ble_ibeacon_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> @idf_parametrize( 'target', ['esp32', 'esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target'] ) -def test_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_gatt_config_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: gatt_client = dut[1] gatt_server = dut[0] gatt_client_addr = ( @@ -365,7 +366,7 @@ def test_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 7: gatt client and gatt server config test for ESP32C2 26mhz xtal # EXAMPLE_CI_ID=3 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -374,14 +375,14 @@ def test_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "gatt_server")}|{os.path.join(os.path.dirname(__file__), "gatt_client")}', + f'{str(CUR_DIR / "gatt_server")}|{str(CUR_DIR / "gatt_client")}', 'esp32c2_cfg_test', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_gatt_config_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: gatt_client = dut[1] gatt_server = dut[0] gatt_client_addr = ( @@ -414,9 +415,7 @@ def test_c2_26mhz_xtal_gatt_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut # Case 8: BLE init deinit loop test @pytest.mark.generic -@pytest.mark.parametrize( - 'config, app_path', [('init_deinit', f'{os.path.join(os.path.dirname(__file__), "gatt_client")}')], indirect=True -) +@pytest.mark.parametrize('config, app_path', [('init_deinit', f'{str(CUR_DIR / "gatt_client")}')], indirect=True) @idf_parametrize( 'target', ['esp32c6', 'esp32h2', 'esp32c3', 'esp32s3', 'esp32c5', 'esp32c61', 'esp32'], indirect=['target'] ) @@ -431,12 +430,12 @@ def test_bluedroid_host_init_deinit(dut: Dut) -> None: # # Case 9: BLE init deinit loop test for ESP32C2 26mhz xtal -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'baud, app_path, config', [ - ('74880', f'{os.path.join(os.path.dirname(__file__), "gatt_client")}', 'esp32c2_init_deinit'), + ('74880', f'{str(CUR_DIR / "gatt_client")}', 'esp32c2_init_deinit'), ], indirect=True, ) diff --git a/examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py b/examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py index d48aef51ac..63b4a3babe 100644 --- a/examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py +++ b/examples/bluetooth/bluedroid/ble_50/pytest_ble50_test.py @@ -1,22 +1,23 @@ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 -import os.path -from typing import Tuple +from pathlib import Path import pytest from pytest_embedded_idf.dut import IdfDut from pytest_embedded_idf.utils import idf_parametrize + +CUR_DIR = Path(__file__).parent.resolve() + + # Case 1: ble50 security client and ble50 security server test # EXAMPLE_CI_ID=6 - - -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}', + f'{str(CUR_DIR / "ble50_security_server")}|{str(CUR_DIR / "ble50_security_client")}', 'name', 'y', ), @@ -24,7 +25,7 @@ from pytest_embedded_idf.utils import idf_parametrize indirect=True, ) @idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']) -def test_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_ble50_security_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( @@ -52,7 +53,7 @@ def test_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 2: ble50 security client and ble50 security server test for ESP32C2 26mhz xtal # EXAMPLE_CI_ID=6 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -61,14 +62,14 @@ def test_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}', + f'{str(CUR_DIR / "ble50_security_server")}|{str(CUR_DIR / "ble50_security_client")}', 'esp32c2_xtal26m', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_ble50_security_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_ble50_security_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( @@ -96,13 +97,13 @@ def test_c2_26mhz_xtal_ble50_security_func(app_path: str, dut: Tuple[IdfDut, Idf # Case 3: period_adv and period_sync test # EXAMPLE_CI_ID=8 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}', + f'{str(CUR_DIR / "periodic_adv")}|{str(CUR_DIR / "periodic_sync")}', 'name', 'y', ), @@ -110,7 +111,7 @@ def test_c2_26mhz_xtal_ble50_security_func(app_path: str, dut: Tuple[IdfDut, Idf indirect=True, ) @idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']) -def test_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_period_adv_sync_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: adv_dut = dut[0] sync_dut = dut[1] @@ -123,14 +124,14 @@ def test_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None adv_dut.expect_exact('Periodic advertising start, status 0', timeout=30) sync_dut.expect_exact('Extended scanning params set, status 0', timeout=30) sync_dut.expect_exact('Extended scanning start, status 0', timeout=30) - sync_dut.expect_exact(f'Create sync with the peer device BE', timeout=30) + sync_dut.expect_exact('Create sync with the peer device BE', timeout=30) sync_dut.expect_exact('Periodic advertising sync establish, status 0', timeout=30) sync_dut.expect_exact('Periodic adv report, sync handle ', timeout=30) # Case 4: period_adv and period_sync test for ESP32C2 26mhz xtal # EXAMPLE_CI_ID=8 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -139,14 +140,14 @@ def test_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "periodic_adv")}|{os.path.join(os.path.dirname(__file__), "periodic_sync")}', + f'{str(CUR_DIR / "periodic_adv")}|{str(CUR_DIR / "periodic_sync")}', 'esp32c2_xtal26m', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_period_adv_sync_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: adv_dut = dut[0] sync_dut = dut[1] @@ -159,20 +160,20 @@ def test_c2_26mhz_xtal_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, Id adv_dut.expect_exact('Periodic advertising start, status 0', timeout=30) sync_dut.expect_exact('Extended scanning params set, status 0', timeout=30) sync_dut.expect_exact('Extended scanning start, status 0', timeout=30) - sync_dut.expect_exact(f'Create sync with the peer device BE', timeout=30) + sync_dut.expect_exact('Create sync with the peer device BE', timeout=30) sync_dut.expect_exact('Periodic advertising sync establish, status 0', timeout=30) sync_dut.expect_exact('Periodic adv report, sync handle ', timeout=30) # Case 5: ble50 security client and ble50 security server config test # EXAMPLE_CI_ID=7 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, config, erase_nvs', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}', + f'{str(CUR_DIR / "ble50_security_server")}|{str(CUR_DIR / "ble50_security_client")}', 'cfg_test', 'y', ), @@ -180,7 +181,7 @@ def test_c2_26mhz_xtal_period_adv_sync_func(app_path: str, dut: Tuple[IdfDut, Id indirect=True, ) @idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32h2', 'esp32s3', 'esp32c61'], indirect=['target']) -def test_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_ble50_security_config_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( @@ -210,7 +211,7 @@ def test_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) - # Case 6: ble50 security client and ble50 security server config test for ESP32C2 26mhz xtal # EXAMPLE_CI_ID=7 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, target, baud, app_path, config, erase_nvs', @@ -219,14 +220,14 @@ def test_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) - 2, 'esp32c2|esp32c2', '74880', - f'{os.path.join(os.path.dirname(__file__), "ble50_security_server")}|{os.path.join(os.path.dirname(__file__), "ble50_security_client")}', + f'{str(CUR_DIR / "ble50_security_server")}|{str(CUR_DIR / "ble50_security_client")}', 'esp32c2_cfg_test', 'y', ), ], indirect=True, ) -def test_c2_26mhz_xtal_ble50_security_config_func(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_c2_26mhz_xtal_ble50_security_config_func(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] client_addr = ( diff --git a/examples/bluetooth/bluedroid/classic_bt/pytest_classic_bt_test.py b/examples/bluetooth/bluedroid/classic_bt/pytest_classic_bt_test.py index 4154dce414..93b5655341 100644 --- a/examples/bluetooth/bluedroid/classic_bt/pytest_classic_bt_test.py +++ b/examples/bluetooth/bluedroid/classic_bt/pytest_classic_bt_test.py @@ -1,21 +1,22 @@ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 -import os.path -from typing import Tuple +from pathlib import Path import pexpect import pytest from pytest_embedded_idf.dut import IdfDut + +CUR_DIR = Path(__file__).parent.resolve() + + # Case 1: SPP - - -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, target, erase_all, config', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "bt_spp_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_initiator")}', + f'{str(CUR_DIR / "bt_spp_acceptor")}|{str(CUR_DIR / "bt_spp_initiator")}', 'esp32|esp32', 'y', 'test', @@ -23,7 +24,7 @@ from pytest_embedded_idf.dut import IdfDut ], indirect=True, ) -def test_bt_spp_only(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_bt_spp_only(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: acceptor = dut[0] initiator = dut[1] @@ -43,20 +44,20 @@ def test_bt_spp_only(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 2: SPP_VFS -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, target, config', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_acceptor")}|{os.path.join(os.path.dirname(__file__), "bt_spp_vfs_initiator")}', + f'{str(CUR_DIR / "bt_spp_vfs_acceptor")}|{str(CUR_DIR / "bt_spp_vfs_initiator")}', 'esp32|esp32', 'test', ), ], indirect=True, ) -def test_bt_spp_vfs(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_bt_spp_vfs(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: acceptor = dut[0] initiator = dut[1] @@ -71,20 +72,20 @@ def test_bt_spp_vfs(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 3: A2DP -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, target, config', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "a2dp_sink")}|{os.path.join(os.path.dirname(__file__), "a2dp_source")}', + f'{str(CUR_DIR / "a2dp_sink")}|{str(CUR_DIR / "a2dp_source")}', 'esp32|esp32', 'test', ), ], indirect=True, ) -def test_bt_a2dp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_bt_a2dp(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: sink_dut = dut[0] source_dut = dut[1] source_dut_mac = source_dut.expect(r'Bluetooth MAC: (([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})').group(1).decode('utf8') @@ -97,20 +98,20 @@ def test_bt_a2dp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 4: HFP -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, target, config', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "hfp_ag")}|{os.path.join(os.path.dirname(__file__), "hfp_hf")}', + f'{str(CUR_DIR / "hfp_ag")}|{str(CUR_DIR / "hfp_hf")}', 'esp32|esp32', 'all', ), ], indirect=True, ) -def test_bt_hfp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_bt_hfp(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: hfp_ag = dut[0] hfp_hf = dut[1] @@ -122,21 +123,20 @@ def test_bt_hfp(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # # Case 5: HID -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, target, config', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "bt_hid_mouse_device")}|' - f'{os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")), "esp_hid_host")}', + f'{str(CUR_DIR / "bt_hid_mouse_device")}|{str(CUR_DIR / ".." / ".." / "esp_hid_host")}', 'esp32|esp32', 'test', ), ], indirect=True, ) -def test_bt_hid(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_bt_hid(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: hid_device = dut[0] hid_host = dut[1] @@ -151,20 +151,20 @@ def test_bt_hid(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 6: L2CAP -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path, target, config', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "bt_l2cap_server")}|{os.path.join(os.path.dirname(__file__), "bt_l2cap_client")}', + f'{str(CUR_DIR / "bt_l2cap_server")}|{str(CUR_DIR / "bt_l2cap_client")}', 'esp32|esp32', 'test', ), ], indirect=True, ) -def test_bt_l2cap(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_bt_l2cap(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: server = dut[0] client = dut[1] diff --git a/examples/bluetooth/nimble/pytest_nimble_test.py b/examples/bluetooth/nimble/pytest_nimble_test.py index 8f9d8a1e65..e50a2e3ff6 100644 --- a/examples/bluetooth/nimble/pytest_nimble_test.py +++ b/examples/bluetooth/nimble/pytest_nimble_test.py @@ -1,22 +1,23 @@ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 -import os.path -from typing import Tuple +from pathlib import Path import pexpect import pytest from pytest_embedded_idf.dut import IdfDut from pytest_embedded_idf.utils import idf_parametrize + +CUR_DIR = Path(__file__).parent.resolve() + + # Case 1: BLE power save test - - -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path', [ ( 2, - f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', + f'{str(CUR_DIR / "power_save")}|{str(CUR_DIR / "blecent")}', ), ], indirect=True, @@ -24,7 +25,7 @@ from pytest_embedded_idf.utils import idf_parametrize @idf_parametrize( 'target', ['esp32c6', 'esp32h2', 'esp32c3', 'esp32s3', 'esp32c5', 'esp32c61', 'esp32'], indirect=['target'] ) -def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: +def test_power_save_conn(app_path: str, dut: tuple[IdfDut, IdfDut]) -> None: peripheral = dut[0] central = dut[1] @@ -39,7 +40,7 @@ def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: # Case 2: BLE power save test for ESP32C2 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'config, count, app_path, baud', @@ -47,14 +48,14 @@ def test_power_save_conn(app_path: str, dut: Tuple[IdfDut, IdfDut]) -> None: ( 'esp32c2_xtal26m', 2, - f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', + f'{str(CUR_DIR / "power_save")}|{str(CUR_DIR / "blecent")}', '74880', ), ], indirect=True, ) @idf_parametrize('target', ['esp32c2'], indirect=['target']) -def test_power_save_conn_esp32c2_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None: +def test_power_save_conn_esp32c2_26mhz(dut: tuple[IdfDut, IdfDut]) -> None: peripheral = dut[0] central = dut[1] @@ -69,7 +70,7 @@ def test_power_save_conn_esp32c2_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None: # Case 2: BLE power save test for ESP32C2ECO4 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.esp32c2eco4 @pytest.mark.parametrize( @@ -78,14 +79,14 @@ def test_power_save_conn_esp32c2_26mhz(dut: Tuple[IdfDut, IdfDut]) -> None: ( 'esp32c2eco4_xtal26m', 2, - f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', + f'{str(CUR_DIR / "power_save")}|{str(CUR_DIR / "blecent")}', '74880', ), ], indirect=True, ) @idf_parametrize('target', ['esp32c2'], indirect=['target']) -def test_power_save_conn_esp32c2eco4(dut: Tuple[IdfDut, IdfDut]) -> None: +def test_power_save_conn_esp32c2eco4(dut: tuple[IdfDut, IdfDut]) -> None: peripheral = dut[0] central = dut[1] @@ -100,7 +101,7 @@ def test_power_save_conn_esp32c2eco4(dut: Tuple[IdfDut, IdfDut]) -> None: # Case 2: BLE power save test for ESP32C3ECO7 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.esp32c3eco7 @pytest.mark.parametrize( 'config, count, app_path', @@ -108,13 +109,13 @@ def test_power_save_conn_esp32c2eco4(dut: Tuple[IdfDut, IdfDut]) -> None: ( 'esp32c3eco7', 2, - f'{os.path.join(os.path.dirname(__file__), "power_save")}|{os.path.join(os.path.dirname(__file__), "blecent")}', + f'{str(CUR_DIR / "power_save")}|{str(CUR_DIR / "blecent")}', ), ], indirect=True, ) @idf_parametrize('target', ['esp32c3'], indirect=['target']) -def test_power_save_conn_esp32c3eco7(dut: Tuple[IdfDut, IdfDut]) -> None: +def test_power_save_conn_esp32c3eco7(dut: tuple[IdfDut, IdfDut]) -> None: peripheral = dut[0] central = dut[1] diff --git a/examples/wifi/getting_started/pytest_wifi_getting_started.py b/examples/wifi/getting_started/pytest_wifi_getting_started.py index c0e96d4ae6..4f2c92075a 100644 --- a/examples/wifi/getting_started/pytest_wifi_getting_started.py +++ b/examples/wifi/getting_started/pytest_wifi_getting_started.py @@ -20,7 +20,7 @@ from pytest_embedded_idf.utils import idf_parametrize # ) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize( 'count, app_path', [ @@ -51,7 +51,7 @@ def test_wifi_getting_started(dut: tuple[IdfDut, IdfDut]) -> None: softap.expect('station .+ join, AID=', timeout=60) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud, app_path', @@ -82,7 +82,7 @@ def test_wifi_getting_started_esp32c2_xtal_26mhz(dut: tuple[IdfDut, IdfDut]) -> softap.expect('station .+ join, AID=', timeout=60) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.esp32c2eco4 @pytest.mark.parametrize( @@ -114,7 +114,7 @@ def test_wifi_getting_started_esp32c2eco4_xtal_26mhz(dut: tuple[IdfDut, IdfDut]) softap.expect('station .+ join, AID=', timeout=60) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.esp32c3eco7 @pytest.mark.parametrize( 'count, config, app_path', diff --git a/examples/wifi/getting_started/station/main/CMakeLists.txt b/examples/wifi/getting_started/station/main/CMakeLists.txt index 2fe97581a2..8ac6097df6 100644 --- a/examples/wifi/getting_started/station/main/CMakeLists.txt +++ b/examples/wifi/getting_started/station/main/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "station_example_main.c" - PRIV_REQUIRES esp_wifi nvs_flash + PRIV_REQUIRES esp_wifi nvs_flash bt INCLUDE_DIRS ".") diff --git a/examples/wifi/getting_started/station/pytest_wifi_station.py b/examples/wifi/getting_started/station/pytest_wifi_station.py index 359452f088..e66404f372 100644 --- a/examples/wifi/getting_started/station/pytest_wifi_station.py +++ b/examples/wifi/getting_started/station/pytest_wifi_station.py @@ -16,7 +16,7 @@ DIFF_THRESHOLD = { } -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize('count, config, skip_autoflash', [(2, 'default|enable_softap', 'y')], indirect=True) @idf_parametrize( 'target', diff --git a/pytest.ini b/pytest.ini index ded9570dd3..2cab870a03 100644 --- a/pytest.ini +++ b/pytest.ini @@ -116,7 +116,7 @@ env_markers = openthread_bbr: tests should be used for openthread border router linked to Internet. openthread_sleep: tests should be used for openthread sleepy device. zigbee_multi_dut: zigbee runner which have multiple duts. - wifi_two_dut: tests should be run on runners which has two wifi duts connected. + two_duts: the runner has two duts with antenna available. generic_multi_device: generic multiple devices whose corresponding gpio pins are connected to each other. twai_network: multiple runners form a TWAI network. sdio_master_slave: Test sdio multi board, esp32+esp32 diff --git a/tools/test_apps/phy/phy_tsens/pytest_phy_tsens.py b/tools/test_apps/phy/phy_tsens/pytest_phy_tsens.py index f2fc1e87b4..77c1d5798d 100644 --- a/tools/test_apps/phy/phy_tsens/pytest_phy_tsens.py +++ b/tools/test_apps/phy/phy_tsens/pytest_phy_tsens.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 import random import string -from typing import Tuple import pexpect import pytest @@ -10,7 +9,7 @@ from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -def run_phy_tsens_test(dut: Tuple[Dut, Dut]) -> None: +def run_phy_tsens_test(dut: tuple[Dut, Dut]) -> None: ap_dut = dut[0] sta_dut = dut[1] @@ -57,7 +56,7 @@ def run_phy_tsens_test(dut: Tuple[Dut, Dut]) -> None: assert 0 < float(temp_val) < 70 -def run_phy_tsens_test_init_wifi_first(dut: Tuple[Dut, Dut]) -> None: +def run_phy_tsens_test_init_wifi_first(dut: tuple[Dut, Dut]) -> None: ap_dut = dut[0] sta_dut = dut[1] @@ -104,7 +103,7 @@ def run_phy_tsens_test_init_wifi_first(dut: Tuple[Dut, Dut]) -> None: assert 0 < float(temp_val) < 70 -def run_phy_tsens_test_with_light_sleep(dut: Tuple[Dut, Dut]) -> None: +def run_phy_tsens_test_with_light_sleep(dut: tuple[Dut, Dut]) -> None: ap_dut = dut[0] sta_dut = dut[1] @@ -144,10 +143,10 @@ def run_phy_tsens_test_with_light_sleep(dut: Tuple[Dut, Dut]) -> None: assert 0 < float(temp_val) < 70 -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.parametrize('count', [2], indirect=True) @idf_parametrize('target', ['esp32c3', 'esp32c6', 'esp32c5', 'esp32s2', 'esp32s3', 'esp32c61'], indirect=['target']) -def test_phy_tsens_coexist(dut: Tuple[Dut, Dut]) -> None: +def test_phy_tsens_coexist(dut: tuple[Dut, Dut]) -> None: for _dut in dut: _dut.expect('esp>') run_phy_tsens_test(dut) @@ -163,7 +162,7 @@ def test_phy_tsens_coexist(dut: Tuple[Dut, Dut]) -> None: run_phy_tsens_test_with_light_sleep(dut) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud', @@ -173,7 +172,7 @@ def test_phy_tsens_coexist(dut: Tuple[Dut, Dut]) -> None: indirect=True, ) @idf_parametrize('target', ['esp32c2'], indirect=['target']) -def test_phy_tsens_coexist_c2_xtal26m(dut: Tuple[Dut, Dut]) -> None: +def test_phy_tsens_coexist_c2_xtal26m(dut: tuple[Dut, Dut]) -> None: for _dut in dut: _dut.expect('esp>') run_phy_tsens_test(dut) @@ -189,7 +188,7 @@ def test_phy_tsens_coexist_c2_xtal26m(dut: Tuple[Dut, Dut]) -> None: run_phy_tsens_test_with_light_sleep(dut) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.xtal_26mhz @pytest.mark.esp32c2eco4 @pytest.mark.parametrize( @@ -200,7 +199,7 @@ def test_phy_tsens_coexist_c2_xtal26m(dut: Tuple[Dut, Dut]) -> None: indirect=True, ) @idf_parametrize('target', ['esp32c2'], indirect=['target']) -def test_phy_tsens_coexist_c2eco4_xtal26m(dut: Tuple[Dut, Dut]) -> None: +def test_phy_tsens_coexist_c2eco4_xtal26m(dut: tuple[Dut, Dut]) -> None: for _dut in dut: _dut.expect('esp>') run_phy_tsens_test(dut) @@ -216,7 +215,7 @@ def test_phy_tsens_coexist_c2eco4_xtal26m(dut: Tuple[Dut, Dut]) -> None: run_phy_tsens_test_with_light_sleep(dut) -@pytest.mark.wifi_two_dut +@pytest.mark.two_duts @pytest.mark.esp32c3eco7 @pytest.mark.parametrize( 'count, config', @@ -226,7 +225,7 @@ def test_phy_tsens_coexist_c2eco4_xtal26m(dut: Tuple[Dut, Dut]) -> None: indirect=True, ) @idf_parametrize('target', ['esp32c3'], indirect=['target']) -def test_phy_tsens_coexist_c3eco7(dut: Tuple[Dut, Dut]) -> None: +def test_phy_tsens_coexist_c3eco7(dut: tuple[Dut, Dut]) -> None: for _dut in dut: _dut.expect('esp>') run_phy_tsens_test(dut)