Skip to content

Commit 427f8e0

Browse files
Verify session profile deprecation warning emits once
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 187f506 commit 427f8e0

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_session_update_profile_params.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ def test_sync_update_profile_params_bool_warns_and_serializes():
7171
assert payload == {"type": "profile", "params": {"persistChanges": True}}
7272

7373

74+
def test_sync_update_profile_params_bool_deprecation_warning_only_emitted_once():
75+
SyncSessionManager._has_warned_update_profile_params_boolean_deprecated = False
76+
client = _SyncClient()
77+
manager = SyncSessionManager(client)
78+
79+
with pytest.warns(DeprecationWarning) as warning_records:
80+
manager.update_profile_params("session-1", True)
81+
manager.update_profile_params("session-2", True)
82+
83+
assert len(warning_records) == 1
84+
85+
7486
def test_sync_update_profile_params_rejects_conflicting_arguments():
7587
manager = SyncSessionManager(_SyncClient())
7688

@@ -97,6 +109,20 @@ async def run() -> None:
97109
assert payload == {"type": "profile", "params": {"persistChanges": True}}
98110

99111

112+
def test_async_update_profile_params_bool_deprecation_warning_only_emitted_once():
113+
AsyncSessionManager._has_warned_update_profile_params_boolean_deprecated = False
114+
client = _AsyncClient()
115+
manager = AsyncSessionManager(client)
116+
117+
async def run() -> None:
118+
with pytest.warns(DeprecationWarning) as warning_records:
119+
await manager.update_profile_params("session-1", True)
120+
await manager.update_profile_params("session-2", True)
121+
assert len(warning_records) == 1
122+
123+
asyncio.run(run())
124+
125+
100126
def test_async_update_profile_params_rejects_conflicting_arguments():
101127
manager = AsyncSessionManager(_AsyncClient())
102128

0 commit comments

Comments
 (0)