Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/actions/setup-python/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Setup Python'
description: 'Prints a greeting message'
description: 'Sets up Python, uv, and installs backend dependencies'
inputs:
python-version:
required: true
Expand All @@ -16,7 +16,8 @@ runs:
with:
python-version: ${{ inputs.python-version }}
enable-cache: true
cache-dependency-path: ./uv.lock
- name: Install visitran-cloud dependencies
cache-dependency-path: backend/uv.lock
- name: Install backend dependencies
shell: bash
run: uv sync
working-directory: backend
run: uv sync --group test
130 changes: 64 additions & 66 deletions .github/workflows/core-backend-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,73 +1,71 @@
---
name: Minimal Tests

on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

env:
FORCE_COLOR: "1"

jobs:
minimal_tests:
name: Minimal Tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.10"]
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Setup Python
uses: ./.github/actions/setup-python/
with:
python-version: ${{ matrix.python-version }}

on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: [ "main"]
# pre-commit checks handled by pre-commit.ci

concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
env:
FORCE_COLOR: "1"
jobs:
minimal_tests:
name: Minimal Tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11"] #,"3.9","3.10"]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v4
with:
lfs: true
- name: Setup Python
uses: ./.github/actions/setup-python/
with:
python-version: ${{ matrix.python-version }}
- name: Cache pre-commit hooks
uses: actions/cache@v4
if: github.ref != 'refs/heads/main'
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run tests
env:
DJANGO_SETTINGS_MODULE: backend.server.settings.dev
run: |
uv run coverage run --rcfile=pyproject.toml --source=. -m \
pytest -x -vv ../tests/unit \
--ignore=../tests/unit/test_logs.py \
--ignore=../tests/unit/test_visitran_adapters \
--ignore=../tests/unit/test_visitran_backend \
-m "not snowflake and not bigquery and not trino and not postgres"

- name: Check pre-commit
if: github.ref != 'refs/heads/main'
run: |
uv run pre-commit run --all-files
- name: Run minimal core tests
run: |
uv run coverage run --rcfile=pyproject.toml --data-file=minimal.cov --context="minimal" --source=. -m \
pytest -x -vv -m "not snowflake and not bigquery and not trino and not postgres"
- name: Run backend tests
run: |
uv run coverage run --rcfile=pyproject.toml --data-file=backend.cov --context="backend" --source=. -m \
pytest -x -vv ./visitran_backend
- name: Generate coverage report
run: |
uv run coverage report -m
uv run coverage xml

- name: Combine to coverage xml
run: |
uv run coverage combine backend.cov minimal.cov
uv run coverage report -m
uv run coverage xml
- name: Git fetch unshallow
run: |
git fetch --unshallow
- name: Git fetch unshallow
working-directory: .
run: git fetch --unshallow

- name: Core SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: ${{ github.actor != 'dependabot[bot]' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ./
args: >
-Dproject.settings=./sonar-project.properties
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated
if: ${{ github.actor != 'dependabot[bot]' }}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: ./
args: >
-Dproject.settings=./sonar-project.properties
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sonar.projectKey=zipstack_visitran_python
sonar.projectKey=Zipstack_visitran
sonar.organization=zipstack
sonar.python.version=3.10
sonar.python.coverage.reportPaths=./coverage.xml
Comment thread
abhizipstack marked this conversation as resolved.
Outdated
Expand Down
12 changes: 4 additions & 8 deletions tests/unit/test_incremental_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,11 @@ def test_valid_incremental_model(self):
# Should not raise any exceptions
model._validate_incremental_config()

def test_invalid_model_no_primary_key(self):
"""Test that model without primary key raises error."""
def test_model_no_primary_key_uses_append_mode(self):
"""Test that model without primary key uses APPEND mode (no error)."""
model = InvalidIncrementalModelNoPrimaryKey()

with pytest.raises(ValueError) as exc_info:
model._validate_incremental_config()

assert "Primary key is required" in str(exc_info.value)
assert "self.primary_key" in str(exc_info.value)
# primary_key is optional — without it, incremental uses APPEND mode
model._validate_incremental_config()

def test_invalid_model_no_delta_strategy(self):
"""Test that model without delta strategy raises error."""
Expand Down
Loading