From cd7d6f1c124b0c9ce024a9a0cad780b94761cf04 Mon Sep 17 00:00:00 2001 From: luaijun Date: Fri, 18 Apr 2025 11:15:12 +0800 Subject: [PATCH] fix: pytest did not recognize test cases --- .gitlab/ci/target-test.yml | 16 ++++++++-------- .../esp_wifi/test_apps/.build-test-rules.yml | 2 ++ .../wifi_connect/pytest_wifi_connect.py | 10 ++++------ .../wifi_function/pytest_wifi_function.py | 15 +++++++-------- .../test_apps/pytest_wpa_supplicant_ut.py | 8 +++----- examples/bluetooth/nimble/pytest_nimble_test.py | 10 ++++------ .../pytest_wifi_getting_started.py | 6 ++---- .../wifi/power_save/pytest_wifi_power_save.py | 10 ++++------ tools/ci/idf_pytest/constants.py | 7 ++++--- .../test_apps/phy/phy_tsens/pytest_phy_tsens.py | 10 ++++------ 10 files changed, 42 insertions(+), 52 deletions(-) diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 71c1ba108b..c1fab4156d 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -335,7 +335,7 @@ pytest_examples_esp32c3eco7_wifi_ap: needs: - job: build_pytest_examples_esp32c3 artifacts: false - tags: [ esp32c3eco7, wifi_ap ,esp32c3] + tags: [ wifi_ap_eco ,esp32c3] pytest_examples_esp32s3_wifi_ap: extends: @@ -380,7 +380,7 @@ pytest_examples_esp32c2eco4_26m_wifi_ap: needs: - job: build_pytest_examples_esp32c2 artifacts: false - tags: [ esp32c2eco4, wifi_ap, xtal_26mhz ,esp32c2 ] + tags: [ wifi_ap_eco, xtal_26mhz , esp32c2] pytest_examples_esp32c6_wifi_ap: extends: @@ -544,7 +544,7 @@ pytest_examples_esp32c3eco7_wifi_two_dut: needs: - job: build_pytest_examples_esp32c3 artifacts: false - tags: [ esp32c3eco7, wifi_two_dut, esp32c3 ] + tags: [ wifi_two_dut_eco, esp32c3 ] pytest_examples_esp32s3_wifi_two_dut: extends: @@ -571,7 +571,7 @@ pytest_examples_esp32c2eco4_wifi_two_dut: needs: - job: build_pytest_examples_esp32c2 artifacts: false - tags: [ esp32c2eco4, wifi_two_dut, xtal_26mhz , esp32c2] + tags: [ wifi_two_dut_eco, xtal_26mhz , esp32c2] pytest_examples_esp32c3_flash_encryption: extends: @@ -1498,7 +1498,7 @@ pytest_test_apps_esp32c2eco4_generic: needs: - job: build_pytest_test_apps_esp32c2 artifacts: false - tags: [ esp32c2eco4, generic, xtal_26mhz , esp32c2] + tags: [ generic_eco, xtal_26mhz , esp32c2] pytest_test_apps_esp32c3_generic: extends: @@ -1516,7 +1516,7 @@ pytest_test_apps_esp32c3eco7_generic: needs: - job: build_pytest_test_apps_esp32c3 artifacts: false - tags: [ esp32c3eco7, generic , esp32c3] + tags: [ generic_eco , esp32c3] pytest_test_apps_esp32c6_generic: extends: @@ -1606,7 +1606,7 @@ pytest_test_apps_esp32c2eco4_wifi_two_dut: needs: - job: build_pytest_test_apps_esp32c2 artifacts: false - tags: [ esp32c2eco4, wifi_two_dut, xtal_26mhz, esp32c2 ] + tags: [ wifi_two_dut_eco, xtal_26mhz, esp32c2 ] pytest_test_apps_esp32c3eco7_wifi_two_dut: extends: @@ -1615,4 +1615,4 @@ pytest_test_apps_esp32c3eco7_wifi_two_dut: needs: - job: build_pytest_test_apps_esp32c3 artifacts: false - tags: [ esp32c3eco7, wifi_two_dut, esp32c3] + tags: [ wifi_two_dut_eco, esp32c3] diff --git a/components/esp_wifi/test_apps/.build-test-rules.yml b/components/esp_wifi/test_apps/.build-test-rules.yml index bf19dc53b2..50782379c6 100644 --- a/components/esp_wifi/test_apps/.build-test-rules.yml +++ b/components/esp_wifi/test_apps/.build-test-rules.yml @@ -10,3 +10,5 @@ components/esp_wifi/test_apps/wifi_connect: components/esp_wifi/test_apps/wifi_function: disable: - if: SOC_WIFI_SUPPORTED != 1 + disable_test: + - if: SOC_WIFI_SUPPORTED != 1 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 f41d4ccb30..5a9def92c5 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 @@ -28,13 +28,12 @@ def test_wifi_connect_cases_esp32c2_xtal26m(case_tester: CaseTester) -> None: @pytest.mark.esp32c2 -@pytest.mark.esp32c2eco4 -@pytest.mark.wifi_two_dut +@pytest.mark.wifi_two_dut_eco @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud', [ - (2, 'esp32c2eco4_xtal26m', '74880'), + (2, 'esp32c2eco4_xtal26m', '74880'), ], indirect=True, ) @@ -43,12 +42,11 @@ def test_wifi_connect_cases_esp32c2eco4_xtal26m(case_tester: CaseTester) -> None @pytest.mark.esp32c3 -@pytest.mark.wifi_two_dut -@pytest.mark.esp32c3eco7 +@pytest.mark.wifi_two_dut_eco @pytest.mark.parametrize( 'count, config', [ - (2, 'esp32c3eco7',), + (2, 'esp32c3eco7'), ], indirect=True, ) diff --git a/components/esp_wifi/test_apps/wifi_function/pytest_wifi_function.py b/components/esp_wifi/test_apps/wifi_function/pytest_wifi_function.py index 13f27f5e04..a37dde3bda 100644 --- a/components/esp_wifi/test_apps/wifi_function/pytest_wifi_function.py +++ b/components/esp_wifi/test_apps/wifi_function/pytest_wifi_function.py @@ -17,6 +17,7 @@ def test_wifi_unit_test(dut: Dut) -> None: @pytest.mark.esp32c2 @pytest.mark.xtal_26mhz +@pytest.mark.generic @pytest.mark.parametrize( 'config, baud', [ @@ -29,13 +30,12 @@ def test_wifi_connect_cases_esp32c2_xtal26m(dut: Dut) -> None: @pytest.mark.esp32c2 -@pytest.mark.esp32c2eco4 @pytest.mark.xtal_26mhz -@pytest.mark.generic +@pytest.mark.generic_eco @pytest.mark.parametrize( - 'config, target, baud', + 'config, baud', [ - ('esp32c2eco4_xtal26m', 'esp32c2', '74880'), + ('esp32c2eco4_xtal26m', '74880'), ], indirect=True, ) @@ -44,12 +44,11 @@ def test_wifi_unit_test_esp32c2eco4_xtal26m(dut: Dut) -> None: @pytest.mark.esp32c3 -@pytest.mark.esp32c3eco7 -@pytest.mark.generic +@pytest.mark.generic_eco @pytest.mark.parametrize( - 'config, target', + 'config', [ - ('esp32c3eco7','esp32c3') + ('esp32c3eco7') ], indirect=True, ) 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 e0237b352b..19d64208b4 100644 --- a/components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py +++ b/components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py @@ -32,8 +32,7 @@ def test_wpa_supplicant_ut_offchan(case_tester: CaseTester) -> None: @pytest.mark.esp32c2 -@pytest.mark.wifi_two_dut -@pytest.mark.esp32c2eco4 +@pytest.mark.wifi_two_dut_eco @pytest.mark.xtal_26mhz @pytest.mark.parametrize( 'count, config, baud', @@ -53,10 +52,9 @@ def test_wpa_supplicant_esp32c2eco4_xtal26mhz(case_tester: CaseTester) -> None: @pytest.mark.esp32c3 -@pytest.mark.wifi_two_dut -@pytest.mark.esp32c3eco7 +@pytest.mark.wifi_two_dut_eco @pytest.mark.parametrize( - 'count, config,', + 'count, config', [ ( 2, diff --git a/examples/bluetooth/nimble/pytest_nimble_test.py b/examples/bluetooth/nimble/pytest_nimble_test.py index fc9b3d30ff..f3606f076e 100644 --- a/examples/bluetooth/nimble/pytest_nimble_test.py +++ b/examples/bluetooth/nimble/pytest_nimble_test.py @@ -63,12 +63,11 @@ 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.xtal_26mhz @pytest.mark.esp32c2 -@pytest.mark.esp32c2eco4 +@pytest.mark.wifi_two_dut_eco +@pytest.mark.xtal_26mhz @pytest.mark.parametrize( - 'config, count, app_path, baud', + 'config, count, app_path, baud,', [ ( 'esp32c2eco4_xtal26m', @@ -94,9 +93,8 @@ 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.esp32c3 -@pytest.mark.esp32c3eco7 +@pytest.mark.wifi_two_dut_eco @pytest.mark.parametrize( 'config, count, app_path', [ diff --git a/examples/wifi/getting_started/pytest_wifi_getting_started.py b/examples/wifi/getting_started/pytest_wifi_getting_started.py index 81bfc46fd2..0fb76c0f33 100644 --- a/examples/wifi/getting_started/pytest_wifi_getting_started.py +++ b/examples/wifi/getting_started/pytest_wifi_getting_started.py @@ -70,9 +70,8 @@ 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.wifi_two_dut_eco @pytest.mark.xtal_26mhz -@pytest.mark.esp32c2eco4 @pytest.mark.esp32c2 @pytest.mark.parametrize( 'count, config, baud, app_path', @@ -102,8 +101,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.esp32c3eco7 +@pytest.mark.wifi_two_dut_eco @pytest.mark.esp32c3 @pytest.mark.parametrize( 'count, config, app_path', diff --git a/examples/wifi/power_save/pytest_wifi_power_save.py b/examples/wifi/power_save/pytest_wifi_power_save.py index f667d8d9e7..a1078f9fee 100644 --- a/examples/wifi/power_save/pytest_wifi_power_save.py +++ b/examples/wifi/power_save/pytest_wifi_power_save.py @@ -76,14 +76,13 @@ def test_wifi_power_save_esp32c2_26mhz(dut: Dut) -> None: _run_test(dut) -@pytest.mark.wifi_ap +@pytest.mark.wifi_ap_eco @pytest.mark.xtal_26mhz @pytest.mark.esp32c2 -@pytest.mark.esp32c2eco4 @pytest.mark.parametrize( 'config, baud', [ - ('c2eco4_xtal26m', '74880',), + ('c2eco4_xtal26m', '74880'), ], indirect=True, ) @@ -91,13 +90,12 @@ def test_wifi_power_save_esp32c2eco4_26mhz(dut: Dut) -> None: _run_test(dut) -@pytest.mark.wifi_ap +@pytest.mark.wifi_ap_eco @pytest.mark.esp32c3 -@pytest.mark.esp32c3eco7 @pytest.mark.parametrize( 'config', [ - ('c3eco7',) + ('c3eco7') ], indirect=True, ) diff --git a/tools/ci/idf_pytest/constants.py b/tools/ci/idf_pytest/constants.py index 7d037a5acd..2fdfeba4ff 100644 --- a/tools/ci/idf_pytest/constants.py +++ b/tools/ci/idf_pytest/constants.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 """ Pytest Related Constants. Don't import third-party packages here. @@ -106,8 +106,9 @@ ENV_MARKERS = { 'twai_network': 'multiple runners form a TWAI network.', 'sdio_master_slave': 'Test sdio multi board.', 'usj_device': 'Test usb_serial_jtag and usb_serial_jtag is used as serial only (not console)', - 'esp32c3eco7': 'esp32c3 major version(v1.1) chips', - 'esp32c2eco4': 'esp32c2 major version(v2.0) chips', + 'wifi_ap_eco': 'a wifi AP in the environment for major version chips', + 'generic_eco': 'tests should be run on generic runners for major version chips', + 'wifi_two_dut_eco': 'tests should be run on runners which has two wifi duts connected for major version chips', } 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 1883fa7452..91e246f602 100644 --- a/tools/test_apps/phy/phy_tsens/pytest_phy_tsens.py +++ b/tools/test_apps/phy/phy_tsens/pytest_phy_tsens.py @@ -191,10 +191,9 @@ 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.wifi_two_dut_eco @pytest.mark.xtal_26mhz @pytest.mark.esp32c2 -@pytest.mark.esp32c2eco4 @pytest.mark.parametrize( 'count, config, baud', [ @@ -218,13 +217,12 @@ 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.esp32c3eco7 +@pytest.mark.wifi_two_dut_eco @pytest.mark.esp32c3 @pytest.mark.parametrize( - 'count, config,', + 'count, config, ', [ - (2, 'c3_eco7',), + (2, 'c3_eco7', ), ], indirect=True, )