test: move the profile-hook keyword compat test into its own module

test_chat_completions.py grew past the 1,000-line test-file guideline with #134320's
TestProfileHookKeywordCompat (1,006 lines). The test pins the transport's hook-call
contract, not response handling, so it moves verbatim to test_profile_hook_keyword_compat.py
(985 lines left). Reported by the review bot on #134320.
This commit is contained in:
kshitijk4poor
2026-10-08 00:00:26 +05:30
committed by kshitij
parent dd7ee86004
commit 3902bbcf7e
2 changed files with 33 additions and 21 deletions

View File

@@ -546,27 +546,6 @@ class TestChatCompletionsLmStudioReasoning:
assert kw["reasoning_effort"] == "high"
class TestProfileHookKeywordCompat:
"""``lmstudio_reasoning_options`` is LM Studio-only: a plugin hook that names the older keywords
without ``**context`` must not start raising TypeError on every request."""
def test_hook_without_var_kwargs_still_called(self, transport):
from providers.base import ProviderProfile
class OldSignature(ProviderProfile):
def build_api_kwargs_extras(self, *, reasoning_config=None, supports_reasoning=False,
qwen_session_metadata=None, model=None, base_url=None,
ollama_num_ctx=None, session_id=None, cache_scope_id=None):
return {}, {"reasoning_effort": "low"}
kw = transport.build_kwargs(model="m", messages=[{"role": "user", "content": "Hi"}],
provider_profile=OldSignature(name="old-signature"))
assert kw["reasoning_effort"] == "low"
class TestChatCompletionsValidate:
def test_none(self, transport):

View File

@@ -0,0 +1,33 @@
"""A plugin profile's ``build_api_kwargs_extras`` written against the older keyword set keeps working.
Split from ``test_chat_completions.py`` (size cap): this pins the transport's hook-call contract,
not response handling.
"""
import pytest
from agent.transports import get_transport
@pytest.fixture
def transport():
import agent.transports.chat_completions # noqa: F401
return get_transport("chat_completions")
class TestProfileHookKeywordCompat:
"""``lmstudio_reasoning_options`` is LM Studio-only: a plugin hook that names the older keywords
without ``**context`` must not start raising TypeError on every request."""
def test_hook_without_var_kwargs_still_called(self, transport):
from providers.base import ProviderProfile
class OldSignature(ProviderProfile):
def build_api_kwargs_extras(self, *, reasoning_config=None, supports_reasoning=False,
qwen_session_metadata=None, model=None, base_url=None,
ollama_num_ctx=None, session_id=None, cache_scope_id=None):
return {}, {"reasoning_effort": "low"}
kw = transport.build_kwargs(model="m", messages=[{"role": "user", "content": "Hi"}],
provider_profile=OldSignature(name="old-signature"))
assert kw["reasoning_effort"] == "low"