Skip to content

Commit 8958e76

Browse files
test(e2e): skip use_sea=True parametrized cases when kernel wheel missing
The connector's coverage CI job runs the full e2e suite, several of whose test classes parametrize ``extra_params`` over ``{}`` and ``{"use_sea": True}``. With ``use_sea=True`` now routing through the Rust kernel via PyO3, those cases die at ``connect()`` with our pointed ImportError because the ``databricks-sql-kernel`` wheel isn't yet on PyPI — and that CI job (sensibly) doesn't try to build it from a sibling repo. Fix: ``pytest_collection_modifyitems`` hook in the top-level ``conftest.py`` that adds a ``skip`` marker to any parametrize case with ``extra_params={"use_sea": True, ...}`` when ``importlib.util.find_spec("databricks_sql_kernel")`` returns ``None``. Behavior change is CI-only — local dev with the kernel wheel installed (via ``maturin develop`` from the kernel repo) runs those cases as before. Once the kernel wheel is published, the [kernel] extra in pyproject.toml gets enabled (see comment block there) and the default-deps CI matrix will install it; the skip then becomes a no-op. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent c0219ee commit 8958e76

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

conftest.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
1+
import importlib.util
12
import os
23
import pytest
34

45

6+
def _kernel_wheel_available() -> bool:
7+
"""The ``use_sea=True`` code path now routes through the Rust
8+
kernel via PyO3. The ``databricks_sql_kernel`` wheel is not
9+
yet on PyPI (built from a separate repo); CI environments
10+
without it should skip ``use_sea=True`` parametrized cases
11+
rather than fail with a hard ImportError."""
12+
return importlib.util.find_spec("databricks_sql_kernel") is not None
13+
14+
15+
def pytest_collection_modifyitems(config, items):
16+
"""Skip parametrized test cases that pass ``use_sea=True`` when
17+
the kernel wheel isn't installed.
18+
19+
The existing e2e suite uses ``@pytest.mark.parametrize(
20+
"extra_params", [{}, {"use_sea": True}])`` to exercise both
21+
backends. When the kernel wheel is missing those cases die at
22+
``connect()`` time with our pointed ImportError; mark them
23+
skipped at collection time so CI signal stays accurate.
24+
"""
25+
if _kernel_wheel_available():
26+
return
27+
skip_marker = pytest.mark.skip(
28+
reason="use_sea=True requires databricks-sql-kernel (not installed)"
29+
)
30+
for item in items:
31+
params = getattr(item, "callspec", None)
32+
if params is None:
33+
continue
34+
extra_params = params.params.get("extra_params")
35+
if isinstance(extra_params, dict) and extra_params.get("use_sea") is True:
36+
item.add_marker(skip_marker)
37+
38+
539
@pytest.fixture(scope="session")
640
def host():
741
return os.getenv("DATABRICKS_SERVER_HOSTNAME")

0 commit comments

Comments
 (0)