From 9fb28f5c0b0f549aa3105a83c876580c0d26c8db Mon Sep 17 00:00:00 2001 From: Euripedes Rocha Filho Date: Mon, 23 Mar 2026 14:10:50 +0100 Subject: [PATCH] test: add pytest-rerunfailures flaky reruns for Modbus TCP multi-DUT Register pytest-rerunfailures in test requirements and mark TCP multi-DUT pytest cases with one rerun and a short delay. --- examples/tcp/pytest_mb_tcp_host_test_slave.py | 1 + examples/tcp/pytest_mb_tcp_master_slave.py | 1 + test_apps/tcp_instances_tests/pytest_mb_tcp_instances.py | 1 + tools/test_requirements.txt | 1 + 4 files changed, 4 insertions(+) diff --git a/examples/tcp/pytest_mb_tcp_host_test_slave.py b/examples/tcp/pytest_mb_tcp_host_test_slave.py index a7653e4..dba042d 100644 --- a/examples/tcp/pytest_mb_tcp_host_test_slave.py +++ b/examples/tcp/pytest_mb_tcp_host_test_slave.py @@ -66,6 +66,7 @@ pattern_dict_slave = { [(1, f"{os.path.join(os.path.dirname(__file__), 'mb_tcp_slave')}")], indirect=True, ) +@pytest.mark.flaky(reruns=1, reruns_delay=1) def test_modbus_tcp_host_to_slave_communication( app_path: str, dut: ModbusTestDut ) -> None: diff --git a/examples/tcp/pytest_mb_tcp_master_slave.py b/examples/tcp/pytest_mb_tcp_master_slave.py index 1b71aa2..08b1e81 100644 --- a/examples/tcp/pytest_mb_tcp_master_slave.py +++ b/examples/tcp/pytest_mb_tcp_master_slave.py @@ -105,6 +105,7 @@ test_configs = [ ], indirect=True, ) +@pytest.mark.flaky(reruns=1, reruns_delay=1) def test_modbus_tcp_communication( app_path: str, dut: Tuple[ModbusTestDut, ModbusTestDut] ) -> None: diff --git a/test_apps/tcp_instances_tests/pytest_mb_tcp_instances.py b/test_apps/tcp_instances_tests/pytest_mb_tcp_instances.py index 5e7d749..979fb4b 100644 --- a/test_apps/tcp_instances_tests/pytest_mb_tcp_instances.py +++ b/test_apps/tcp_instances_tests/pytest_mb_tcp_instances.py @@ -105,6 +105,7 @@ test_configs = [ ], indirect=True, ) +@pytest.mark.flaky(reruns=1, reruns_delay=1) def test_modbus_tcp_communication(dut: Tuple[ModbusTestDut, ModbusTestDut]) -> None: dut_master = dut[1] dut_slave = dut[0] diff --git a/tools/test_requirements.txt b/tools/test_requirements.txt index 37588f6..9bd3235 100644 --- a/tools/test_requirements.txt +++ b/tools/test_requirements.txt @@ -1,4 +1,5 @@ pytest +pytest-rerunfailures>=12.0 pytest-embedded>=1.18.2 pytest-embedded-idf pytest-embedded-serial>=1.18.2