From 659d27b5138ee4750e258bc8f60a286e50bc07ad Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Wed, 26 Aug 2026 20:19:51 +0800 Subject: [PATCH] Move test_utils to bumble.testing --- bumble/testing/__init__.py | 13 +++++++++++++ {tests => bumble/testing}/test_utils.py | 0 tests/aics_test.py | 3 +-- tests/asha_test.py | 3 +-- tests/avrcp_test.py | 3 +-- tests/bap_test.py | 2 +- tests/battery_service_test.py | 3 +-- tests/cap_test.py | 3 +-- tests/csip_test.py | 3 +-- tests/device_test.py | 3 +-- tests/gatt_service_test.py | 3 +-- tests/gatt_test.py | 3 +-- tests/gmap_test.py | 3 +-- tests/hap_test.py | 3 +-- tests/heart_rate_service_test.py | 3 +-- tests/hfp_test.py | 3 +-- tests/l2cap_test.py | 3 +-- tests/mcp_test.py | 2 +- tests/rfcomm_test.py | 3 +-- tests/sdp_test.py | 3 +-- tests/self_test.py | 3 +-- tests/vcp_test.py | 3 +-- tests/vocs_test.py | 3 +-- 23 files changed, 34 insertions(+), 40 deletions(-) create mode 100644 bumble/testing/__init__.py rename {tests => bumble/testing}/test_utils.py (100%) diff --git a/bumble/testing/__init__.py b/bumble/testing/__init__.py new file mode 100644 index 000000000..daaad59cf --- /dev/null +++ b/bumble/testing/__init__.py @@ -0,0 +1,13 @@ +# Copyright 2021-2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/tests/test_utils.py b/bumble/testing/test_utils.py similarity index 100% rename from tests/test_utils.py rename to bumble/testing/test_utils.py diff --git a/tests/aics_test.py b/tests/aics_test.py index 4d0cdf201..33a8bba16 100644 --- a/tests/aics_test.py +++ b/tests/aics_test.py @@ -32,8 +32,7 @@ Mute, ) from bumble.profiles.vcs import VolumeControlService, VolumeControlServiceProxy - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Tests diff --git a/tests/asha_test.py b/tests/asha_test.py index 97e7e39c3..b645f2d8c 100644 --- a/tests/asha_test.py +++ b/tests/asha_test.py @@ -20,8 +20,7 @@ from bumble import device as bumble_device from bumble.profiles import asha - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- HI_SYNC_ID = b'\x00\x01\x02\x03\x04\x05\x06\x07' diff --git a/tests/avrcp_test.py b/tests/avrcp_test.py index b2cfb8dea..7953352e8 100644 --- a/tests/avrcp_test.py +++ b/tests/avrcp_test.py @@ -25,8 +25,7 @@ import pytest from bumble import avc, avctp, avrcp - -from . import test_utils +from bumble.testing import test_utils # ----------------------------------------------------------------------------- diff --git a/tests/bap_test.py b/tests/bap_test.py index d2945f7cd..a3b43567b 100644 --- a/tests/bap_test.py +++ b/tests/bap_test.py @@ -55,7 +55,7 @@ PublishedAudioCapabilitiesService, PublishedAudioCapabilitiesServiceProxy, ) -from tests.test_utils import TwoDevices, async_barrier +from bumble.testing.test_utils import TwoDevices, async_barrier # ----------------------------------------------------------------------------- # Logging diff --git a/tests/battery_service_test.py b/tests/battery_service_test.py index ed3246bbd..5ac4ae339 100644 --- a/tests/battery_service_test.py +++ b/tests/battery_service_test.py @@ -17,8 +17,7 @@ from bumble import device as device_module from bumble.profiles import battery_service - -from . import test_utils +from bumble.testing import test_utils # ----------------------------------------------------------------------------- diff --git a/tests/cap_test.py b/tests/cap_test.py index 9676eda34..c4d497561 100644 --- a/tests/cap_test.py +++ b/tests/cap_test.py @@ -23,8 +23,7 @@ from bumble import device, gatt from bumble.profiles import cap, csip - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Logging diff --git a/tests/csip_test.py b/tests/csip_test.py index 29bfac4b9..865ad71e6 100644 --- a/tests/csip_test.py +++ b/tests/csip_test.py @@ -25,8 +25,7 @@ from bumble import device from bumble.profiles import csip - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Logging diff --git a/tests/device_test.py b/tests/device_test.py index ae454dfbf..4f945f10b 100644 --- a/tests/device_test.py +++ b/tests/device_test.py @@ -53,8 +53,7 @@ Role, ) from bumble.host import DataPacketQueue, Host - -from .test_utils import TwoDevices, async_barrier +from bumble.testing.test_utils import TwoDevices, async_barrier # ----------------------------------------------------------------------------- # Constants diff --git a/tests/gatt_service_test.py b/tests/gatt_service_test.py index 90b5c911c..b5eeb34bc 100644 --- a/tests/gatt_service_test.py +++ b/tests/gatt_service_test.py @@ -21,8 +21,7 @@ from bumble import device, gatt from bumble.profiles import gatt_service - -from . import test_utils +from bumble.testing import test_utils # ----------------------------------------------------------------------------- diff --git a/tests/gatt_test.py b/tests/gatt_test.py index e167cc1bd..02f97a222 100644 --- a/tests/gatt_test.py +++ b/tests/gatt_test.py @@ -64,8 +64,7 @@ UTF8CharacteristicAdapter, UTF8CharacteristicProxyAdapter, ) - -from .test_utils import Devices, TwoDevices, async_barrier +from bumble.testing.test_utils import Devices, TwoDevices, async_barrier # ----------------------------------------------------------------------------- diff --git a/tests/gmap_test.py b/tests/gmap_test.py index cf1f9d3fc..c97095500 100644 --- a/tests/gmap_test.py +++ b/tests/gmap_test.py @@ -29,8 +29,7 @@ UggFeatures, UgtFeatures, ) - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Tests diff --git a/tests/hap_test.py b/tests/hap_test.py index 3e1effca3..4647bda3e 100644 --- a/tests/hap_test.py +++ b/tests/hap_test.py @@ -25,8 +25,7 @@ from bumble import att, device from bumble.keys import PairingKeys from bumble.profiles import hap - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Logging diff --git a/tests/heart_rate_service_test.py b/tests/heart_rate_service_test.py index 274e329e8..70119c1f7 100644 --- a/tests/heart_rate_service_test.py +++ b/tests/heart_rate_service_test.py @@ -20,8 +20,7 @@ from bumble import device as device_module from bumble.profiles import heart_rate_service - -from . import test_utils +from bumble.testing import test_utils # ----------------------------------------------------------------------------- diff --git a/tests/hfp_test.py b/tests/hfp_test.py index 7cea3ad60..5b1bbdaaf 100644 --- a/tests/hfp_test.py +++ b/tests/hfp_test.py @@ -23,8 +23,7 @@ import pytest_asyncio from bumble import core, hci, hfp, rfcomm - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Logging diff --git a/tests/l2cap_test.py b/tests/l2cap_test.py index 982db66e6..aaef46e91 100644 --- a/tests/l2cap_test.py +++ b/tests/l2cap_test.py @@ -26,8 +26,7 @@ import pytest from bumble import core, l2cap - -from .test_utils import TwoDevices, async_barrier +from bumble.testing.test_utils import TwoDevices, async_barrier # ----------------------------------------------------------------------------- # Logging diff --git a/tests/mcp_test.py b/tests/mcp_test.py index 993bd52e9..6e5ec3f09 100644 --- a/tests/mcp_test.py +++ b/tests/mcp_test.py @@ -25,7 +25,7 @@ from bumble import device from bumble.profiles import mcp -from tests.test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Logging diff --git a/tests/rfcomm_test.py b/tests/rfcomm_test.py index b9b526487..435dff3c2 100644 --- a/tests/rfcomm_test.py +++ b/tests/rfcomm_test.py @@ -30,8 +30,7 @@ find_rfcomm_channels, make_service_sdp_records, ) - -from . import test_utils +from bumble.testing import test_utils _TIMEOUT = 0.1 diff --git a/tests/sdp_test.py b/tests/sdp_test.py index ac7256a81..d572ea440 100644 --- a/tests/sdp_test.py +++ b/tests/sdp_test.py @@ -34,8 +34,7 @@ DataElement, ServiceAttribute, ) - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # pylint: disable=invalid-name diff --git a/tests/self_test.py b/tests/self_test.py index 5285a3f86..3d7dbdc90 100644 --- a/tests/self_test.py +++ b/tests/self_test.py @@ -33,8 +33,7 @@ OobContext, OobLegacyContext, ) - -from .test_utils import TwoDevices, async_barrier +from bumble.testing.test_utils import TwoDevices, async_barrier # ----------------------------------------------------------------------------- # Logging diff --git a/tests/vcp_test.py b/tests/vcp_test.py index 59e64306d..a60808125 100644 --- a/tests/vcp_test.py +++ b/tests/vcp_test.py @@ -22,8 +22,7 @@ from bumble import device from bumble.profiles import vcs - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Logging diff --git a/tests/vocs_test.py b/tests/vocs_test.py index 84ca0dd48..d5aab0ceb 100644 --- a/tests/vocs_test.py +++ b/tests/vocs_test.py @@ -34,8 +34,7 @@ VolumeOffsetControlServiceProxy, VolumeOffsetState, ) - -from .test_utils import TwoDevices +from bumble.testing.test_utils import TwoDevices # ----------------------------------------------------------------------------- # Tests