test(config): make refresh_skew rejection test load-bearing (#6080)

test_refresh_skew_rejects_negative_and_boolean omitted the required
token_url, so McpOAuthConfig(refresh_skew_seconds=-1) failed validation
on the missing field alone -- deleting the ge=0 bound and the boolean
validator would leave the test green. Pass token_url (the same URL the
refresh_skew_seconds=0 boundary test uses) so only the guards can
satisfy pytest.raises; verified by stripping both guards from
extensions_config.py, which now fails exactly the two parametrized
cases, and restoring them, which returns the suite to 42 passed.

Also move SandboxOwnershipConfig up beside the other config imports
and drop the redundant in-test `import pytest` (review nits on #6026).

Generated-by: ZCode (GLM, coding agent)

Co-authored-by: liwenjie200543 <liwenjie200543@users.noreply.github.com>
This commit is contained in:
kuse 2026-09-30 17:21:43 +08:00 committed by GitHub
parent b73a4e79bf
commit 8ecff3be95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,7 +17,7 @@ from deerflow.config.app_config import CircuitBreakerConfig
from deerflow.config.extensions_config import McpOAuthConfig, McpServerConfig
from deerflow.config.model_config import ModelConfig
from deerflow.config.run_events_config import RunEventsConfig
from deerflow.config.sandbox_config import SandboxConfig
from deerflow.config.sandbox_config import SandboxConfig, SandboxOwnershipConfig
from deerflow.config.summarization_config import SummarizationConfig
@ -54,7 +54,7 @@ class TestMcpTimeoutGuards:
@pytest.mark.parametrize("bad", [-1, True])
def test_refresh_skew_rejects_negative_and_boolean(self, bad: int | bool) -> None:
with pytest.raises(ValidationError):
McpOAuthConfig(refresh_skew_seconds=bad)
McpOAuthConfig(token_url="https://sso.example.org/token", refresh_skew_seconds=bad)
class TestStreamChunkTimeoutGuard:
@ -102,10 +102,6 @@ class TestSiblingBoolRejection:
"""Same-class siblings with bounds but no boolean rejection, flagged in review."""
def test_sandbox_numeric_fields_reject_booleans(self) -> None:
import pytest
from deerflow.config.sandbox_config import SandboxOwnershipConfig
with pytest.raises(ValidationError):
SandboxConfig(use="local", replicas=True)
with pytest.raises(ValidationError):
@ -128,8 +124,6 @@ class TestSiblingBoolRejection:
SandboxOwnershipConfig(ttl_multiplier=True)
def test_ownership_defaults_still_pass(self) -> None:
from deerflow.config.sandbox_config import SandboxOwnershipConfig
config = SandboxOwnershipConfig()
assert config.renewal_interval_seconds == 30.0
assert config.ttl_multiplier == 4.0