From 3c8fe5637d11bb0522cadec933fcaf01a50ee1b9 Mon Sep 17 00:00:00 2001 From: uier Date: Tue, 16 Jun 2026 12:18:12 +0000 Subject: [PATCH] tests: Fix pytest 9.1 compat by removing trailing commas in parametrize and setting asyncio_mode --- pyproject.toml | 1 + tests/avrcp_test.py | 6 +++--- tests/csip_test.py | 2 +- tests/device_test.py | 6 +++--- tests/hci_test.py | 6 +++--- tests/hfp_test.py | 4 ++-- tests/l2cap_test.py | 4 ++-- tests/self_test.py | 2 +- tests/transport_test.py | 6 +++--- 9 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2378f93..0d0e5a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,6 +132,7 @@ write_to = "bumble/_version.py" [tool.pytest.ini_options] pythonpath = "." testpaths = ["tests"] +asyncio_mode = "auto" [tool.pylint.master] init-hook = 'import sys; sys.path.append(".")' diff --git a/tests/avrcp_test.py b/tests/avrcp_test.py index 1c50f7f..b2cfb8d 100644 --- a/tests/avrcp_test.py +++ b/tests/avrcp_test.py @@ -46,7 +46,7 @@ class TwoDevices(test_utils.TwoDevices): @pytest.mark.parametrize( - "command,", + "command", [ avrcp.GetPlayStatusCommand(), avrcp.GetCapabilitiesCommand( @@ -132,7 +132,7 @@ def test_command(command: avrcp.Command): @pytest.mark.parametrize( - "event,", + "event", [ avrcp.UidsChangedEvent(uid_counter=7), avrcp.TrackChangedEvent(uid=12356), @@ -159,7 +159,7 @@ def test_event(event: avrcp.Event): @pytest.mark.parametrize( - "response,", + "response", [ avrcp.GetPlayStatusResponse( song_length=1010, song_position=13, play_status=avrcp.PlayStatus.PAUSED diff --git a/tests/csip_test.py b/tests/csip_test.py index 497c670..29bfac4 100644 --- a/tests/csip_test.py +++ b/tests/csip_test.py @@ -72,7 +72,7 @@ def test_sef(): # ----------------------------------------------------------------------------- @pytest.mark.asyncio @pytest.mark.parametrize( - 'sirk_type,', [(csip.SirkType.ENCRYPTED), (csip.SirkType.PLAINTEXT)] + 'sirk_type', [(csip.SirkType.ENCRYPTED), (csip.SirkType.PLAINTEXT)] ) async def test_csis(sirk_type): SIRK = bytes.fromhex('2f62c8ae41867d1bb619e788a2605faa') diff --git a/tests/device_test.py b/tests/device_test.py index 2d1b6cc..a45c43d 100644 --- a/tests/device_test.py +++ b/tests/device_test.py @@ -278,7 +278,7 @@ async def test_legacy_advertising(): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - 'auto_restart,', + 'auto_restart', (True, False), ) @pytest.mark.asyncio @@ -357,7 +357,7 @@ async def test_advertising_and_scanning(): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - 'own_address_type,', + 'own_address_type', (OwnAddressType.PUBLIC, OwnAddressType.RANDOM), ) @pytest.mark.asyncio @@ -395,7 +395,7 @@ async def test_extended_advertising_connection(own_address_type): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - 'own_address_type,', + 'own_address_type', (OwnAddressType.PUBLIC, OwnAddressType.RANDOM), ) @pytest.mark.asyncio diff --git a/tests/hci_test.py b/tests/hci_test.py index dc744a9..0a09584 100644 --- a/tests/hci_test.py +++ b/tests/hci_test.py @@ -297,7 +297,7 @@ def test_custom_le_meta_event(): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - "clazz,", + "clazz", [ clazz[1] for clazz in inspect.getmembers(hci) @@ -313,7 +313,7 @@ def test_hci_command_subclasses_op_code(clazz: type[hci.HCI_Command]): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - "clazz,", + "clazz", [ clazz[1] for clazz in inspect.getmembers(hci) @@ -330,7 +330,7 @@ def test_hci_event_subclasses_event_code(clazz: type[hci.HCI_Event]): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - "clazz,", + "clazz", [ clazz[1] for clazz in inspect.getmembers(hci) diff --git a/tests/hfp_test.py b/tests/hfp_test.py index 19615a5..7cea3ad 100644 --- a/tests/hfp_test.py +++ b/tests/hfp_test.py @@ -333,7 +333,7 @@ async def test_query_calls_with_calls( # ----------------------------------------------------------------------------- @pytest.mark.asyncio @pytest.mark.parametrize( - "operation,", + "operation", ( hfp.CallHoldOperation.RELEASE_ALL_HELD_CALLS, hfp.CallHoldOperation.RELEASE_ALL_ACTIVE_CALLS, @@ -358,7 +358,7 @@ async def test_hold_call_without_call_index( # ----------------------------------------------------------------------------- @pytest.mark.asyncio @pytest.mark.parametrize( - "operation,", + "operation", ( hfp.CallHoldOperation.RELEASE_SPECIFIC_CALL, hfp.CallHoldOperation.HOLD_ALL_CALLS_EXCEPT, diff --git a/tests/l2cap_test.py b/tests/l2cap_test.py index 0cb1db9..f5387c5 100644 --- a/tests/l2cap_test.py +++ b/tests/l2cap_test.py @@ -197,7 +197,7 @@ async def test_basic_connection(): # ----------------------------------------------------------------------------- -@pytest.mark.parametrize("info_type,", list(l2cap.L2CAP_Information_Request.InfoType)) +@pytest.mark.parametrize("info_type", list(l2cap.L2CAP_Information_Request.InfoType)) async def test_l2cap_information_request(monkeypatch, info_type): # TODO: Replace handlers with API when implemented devices = await TwoDevices.create_with_connection() @@ -321,7 +321,7 @@ async def test_mtu(): # ----------------------------------------------------------------------------- @pytest.mark.asyncio -@pytest.mark.parametrize("mtu,", (50, 255, 256, 1000)) +@pytest.mark.parametrize("mtu", (50, 255, 256, 1000)) async def test_enhanced_retransmission_mode(mtu: int): devices = TwoDevices() await devices.setup_connection() diff --git a/tests/self_test.py b/tests/self_test.py index 069c9a6..5285a3f 100644 --- a/tests/self_test.py +++ b/tests/self_test.py @@ -68,7 +68,7 @@ async def test_self_disconnection(): # ----------------------------------------------------------------------------- @pytest.mark.asyncio @pytest.mark.parametrize( - 'responder_role,', + 'responder_role', (Role.CENTRAL, Role.PERIPHERAL), ) async def test_self_classic_connection(responder_role): diff --git a/tests/transport_test.py b/tests/transport_test.py index c7c3c1c..4136734 100644 --- a/tests/transport_test.py +++ b/tests/transport_test.py @@ -102,7 +102,7 @@ def test_parser_extensions(): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - "address,", + "address", ("127.0.0.1", "::1"), ) async def test_tcp_connection(address): @@ -205,7 +205,7 @@ async def test_unix_connection_abstract(): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - "address,", + "address", ("127.0.0.1", "[::1]"), ) async def test_android_netsim_connection(address): @@ -228,7 +228,7 @@ async def test_android_netsim_connection(address): # ----------------------------------------------------------------------------- @pytest.mark.parametrize( - "spec,", + "spec", ( "android-netsim:[::1]:{port},mode=host[a=b,c=d]", "android-netsim:localhost:{port},mode=host[a=b,c=d]",