@@ -452,21 +452,20 @@ def fake_session(**kw):
452452 assert captured ["telemetry_circuit_breaker_enabled" ] is False
453453
454454
455- def test_open_session_omits_phase_7_kwargs_kernel_does_not_accept (monkeypatch ):
456- """Phase-7 identity/telemetry kwargs must NOT be forwarded to a kernel
457- ``Session`` whose (fixed, no-``**kwargs``) constructor doesn't declare
458- them.
455+ def test_open_session_omits_optional_kwargs_kernel_does_not_accept (monkeypatch ):
456+ """Optional kwargs must NOT be forwarded to a kernel ``Session`` whose
457+ fixed constructor doesn't declare them.
459458
460459 The real ``databricks_sql_kernel.Session`` is a PyO3 class with a fixed
461460 signature. The other tests here use a ``**kwargs`` MagicMock that silently
462461 swallows unsupported kwargs; this fixed-signature fake proves the client
463- filters optional telemetry kwargs.
462+ filters optional kwargs.
464463 """
465464 captured = {}
466465
467- # Accept baseline connection/tls/retry/pool kwargs but no phase-7 identity
468- # or telemetry kwargs, and no **kwargs catch-all.
469- def fake_session_v0_2_0 (
466+ # Accept baseline connection/tls/retry kwargs but no max-connections,
467+ # phase-7 identity, or telemetry kwargs, and no **kwargs catch-all.
468+ def fake_session_without_optional_kwargs (
470469 host ,
471470 http_path ,
472471 * ,
@@ -494,14 +493,15 @@ def fake_session_v0_2_0(
494493 complex_types_as_json = False ,
495494 intervals_as_string = False ,
496495 request_timeout_secs = None ,
497- max_connections = None ,
498496 ):
499497 captured ["host" ] = host
500498 sess = MagicMock ()
501499 sess .session_id = "sess-id"
502500 return sess
503501
504- monkeypatch .setattr (kernel_client ._kernel , "Session" , fake_session_v0_2_0 )
502+ monkeypatch .setattr (
503+ kernel_client ._kernel , "Session" , fake_session_without_optional_kwargs
504+ )
505505 monkeypatch .setattr (
506506 kernel_client .TelemetryHelper ,
507507 "get_driver_system_configuration" ,
@@ -525,17 +525,18 @@ def fake_session_v0_2_0(
525525 kwargs = kernel_client ._kernel_telemetry_kwargs (
526526 {"enable_telemetry" : True , "telemetry_batch_size" : 17 }
527527 )
528- assert kwargs == {}, f"expected no phase-7 kwargs on 0.2.0 Session , got { kwargs } "
528+ assert kwargs == {}, f"expected no unsupported phase-7 kwargs, got { kwargs } "
529529
530530 c = kernel_client .KernelDatabricksClient (
531531 server_hostname = "example.cloud.databricks.com" ,
532532 http_path = "/sql/1.0/warehouses/abc" ,
533533 auth_provider = AccessTokenAuthProvider ("dapi-test" ),
534534 ssl_options = None ,
535+ max_connections = 41 ,
535536 telemetry_options = {"enable_telemetry" : True , "telemetry_batch_size" : 17 },
536537 )
537- # Would raise TypeError: unexpected keyword argument if the client
538- # forwarded phase-7 kwargs the fixed-signature Session doesn't declare.
538+ # Would raise TypeError if the client forwarded max-connections or
539+ # phase-7 kwargs the fixed-signature Session doesn't declare.
539540 c .open_session (session_configuration = None , catalog = None , schema = None )
540541 assert captured ["host" ] == "example.cloud.databricks.com"
541542
0 commit comments