Compare commits

...

1 Commits

Author SHA1 Message Date
Pat Sukprasert 93787419c5 ci(test): add Pytest (databricks) lane for the databricks extra
The `databricks` extra (psycopg / databricks-sdk / mlflow) isn't installed
on the standard pytest lanes (they use `--extra all --extra dev`, which has
databricks-sdk but not psycopg). So a test that builds a postgresql+psycopg
engine or calls the Databricks SDK fails with `ModuleNotFoundError: psycopg`
on the catch-all `misc` lane.

Add a `databricks` pytest marker and a dedicated `Pytest (databricks)` lane
that installs `--extra databricks` and runs `-m databricks`. The standard
lanes now run `-m "not databricks"`, so marked tests are deselected there
and selected only in the new lane. Register the marker in pyproject and gate
the lane in merge-ready's required checks.

Decouples the upcoming Lakebase token-engine tests (psycopg-dependent) from
the lean lanes via the @pytest.mark.databricks decorator.

Co-authored-by: Isaac
2026-06-24 22:10:04 +07:00
3 changed files with 15 additions and 1 deletions
+2
View File
@@ -21,6 +21,7 @@ REQUIRED=(
"Pytest (server-rest)"
"Pytest (spec-llms)"
"Pytest (misc)"
"Pytest (databricks)"
"E2E Tests (shard 0/4)"
"E2E Tests (shard 1/4)"
"E2E Tests (shard 2/4)"
@@ -47,6 +48,7 @@ ALLOW_SKIP=(
"Pytest (server-rest)"
"Pytest (spec-llms)"
"Pytest (misc)"
"Pytest (databricks)"
"E2E Tests (shard 0/4)"
"E2E Tests (shard 1/4)"
"E2E Tests (shard 2/4)"
+12 -1
View File
@@ -112,6 +112,14 @@ jobs:
--ignore=tests/spec
--ignore=tests/llms
--ignore=tests/codex_parity
# Databricks-coupled tests (Lakebase token engine, psycopg). This is
# the only lane that installs the `databricks` extra; the
# @pytest.mark.databricks marker keeps these tests off the lean lanes
# (which run -m "not databricks") and selects them here.
- group: databricks
paths: tests/db tests/deploy
extra: databricks
markexpr: databricks
steps:
- name: Check out repo
@@ -144,7 +152,9 @@ jobs:
key: venv-${{ runner.os }}-${{ hashFiles('.python-version') }}-${{ hashFiles('uv.lock') }}
- name: Install dependencies
run: uv sync --locked --extra all --extra dev
# matrix.extra (e.g. "databricks") adds an extra for lanes that need it;
# empty for the default lanes.
run: uv sync --locked --extra all --extra dev ${{ matrix.extra && format('--extra {0}', matrix.extra) || '' }}
- name: Run pytest
shell: bash
@@ -165,6 +175,7 @@ jobs:
# shellcheck disable=SC2086
env -u OPENAI_API_KEY -u ANTHROPIC_API_KEY -u DATABRICKS_TOKEN \
uv run pytest ${{ matrix.paths }} \
-m "${{ matrix.markexpr || 'not databricks' }}" \
-n ${{ matrix.workers || '8' }} \
--dist=${{ matrix.dist || 'loadfile' }} \
--timeout=${{ matrix.timeout || '300' }} \
+1
View File
@@ -301,6 +301,7 @@ pythonpath = [".", "sdks/python-client", "sdks/ui"]
markers = [
"live: end-to-end tests requiring real LLM API key (run with --llm-api-key)",
"live_app: end-to-end tests requiring a deployed Databricks App server",
"databricks: requires the `databricks` extra (psycopg / databricks-sdk / mlflow). Deselected on the standard lanes via -m 'not databricks'; runs only in the Pytest (databricks) lane, which installs the extra. Use for tests that build a postgresql+psycopg engine or call the Databricks SDK.",
"model(name, ...): one arg pins this test to that model overriding the suite-wide --model CLI default; multiple args fan the test out across all listed models via indirect parametrize.",
"model_pinned: opt out of tests/_model_pools.py spreading and retry rotation; literal model strings are used as written.",
"flaky(reruns=2, reruns_delay=0): rerun a nondeterministic test on failure (pytest-rerunfailures). Use for tests flaky due to timing/scheduling races (e.g. PTY drain timing), NOT real-LLM nondeterminism — those use llm_flaky, which rotates models per attempt.",