From 2816fc0ec8454f9402bec760dd17ebc265ee539a Mon Sep 17 00:00:00 2001 From: Clint Goudie-Nice <3596299+cgoudie@users.noreply.github.com> Date: Thu, 3 Sep 2026 05:48:31 -0600 Subject: [PATCH] tests/integration: #2021 regression test without the fix (expected to fail on some offsets) --- tests/integration/test_issue_2021.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/integration/test_issue_2021.py diff --git a/tests/integration/test_issue_2021.py b/tests/integration/test_issue_2021.py new file mode 100644 index 000000000..445458d10 --- /dev/null +++ b/tests/integration/test_issue_2021.py @@ -0,0 +1,23 @@ +import asyncio + +import pytest +from bumble.transport.common import Transport + +from bleak import BleakScanner + +# The kernel stops an LE-only scan after DISCOV_LE_TIMEOUT (10.24 s) and BlueZ +# restarts it IDLE_DISCOV_TIMEOUT (5 s) later. A stop that arrives while the +# kernel is between states is rejected and surfaces as InProgress; the window +# is narrow, so the stop is placed at several points around the restart. +STOP_AFTER = [10.0, 12.0, 15.0, 15.2, 15.4, 16.0] + + +@pytest.mark.parametrize("stop_after", STOP_AFTER) +async def test_stop_around_kernel_le_scan_restart( + stop_after: float, hci_transport: Transport +) -> None: + """ + Regression test for . + """ + async with BleakScanner(): + await asyncio.sleep(stop_after)