Skip to content

Commit 4849a44

Browse files
cathleenyIsaac
andcommitted
test(kernel): fail the loopback tests clearly when a stub shadows the kernel
Match the existing real-wheel guard: if sys.modules holds a fake databricks_sql_kernel, fail with a clear message instead of a listener timeout. Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 26b187a commit 4849a44

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎tests/unit/test_session.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,11 @@ def _require_real_kernel_wheel(port_kwarg):
14001400
ilm.version("databricks-sql-kernel")
14011401
except ilm.PackageNotFoundError:
14021402
pytest.skip("databricks-sql-kernel wheel not installed")
1403+
if not getattr(__import__("databricks_sql_kernel"), "__file__", None):
1404+
pytest.fail(
1405+
"databricks-sql-kernel is installed but sys.modules holds a stub "
1406+
"(no __file__); a unit-test fake is shadowing the real wheel."
1407+
)
14031408
if port_kwarg:
14041409
from databricks.sql.backend.kernel import client as kernel_client
14051410

0 commit comments

Comments
 (0)