Skip to content

Unit tests for task_api_client #142

Unit tests for task_api_client

Unit tests for task_api_client #142

name: Run Tests
on:
pull_request:
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
env:
DATASOURCE_DB_USERNAME: postgres
DATASOURCE_DB_PASSWORD: postgres
DATASOURCE_DB_DATABASE: hutch-omop
DATASOURCE_DB_SCHEMA: omop
DATASOURCE_DB_PORT: 5432
DATASOURCE_DB_HOST: localhost
TASK_API_TYPE: a
COLLECTION_ID: test_collection
TASK_API_BASE_URL: http://localhost:8000
TASK_API_USERNAME: test_user
TASK_API_PASSWORD: test_password
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: hutch-omop
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
omop-lite:
image: ghcr.io/health-informatics-uon/omop-lite
env:
DB_HOST: postgres
DB_PASSWORD: postgres
DB_NAME: hutch-omop
SYNTHETIC: true
steps:
- uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.16"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: uv sync
run: uv sync --frozen --dev
- name: Run tests
run: |
set -e
uv run pytest tests --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=hutch_bunny tests | tee pytest-coverage.txt
test ${PIPESTATUS[0]} -eq 0
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@81882822c5b22af01f91bd3eacb1cefb6ad73dc2
with:
pytest-coverage-path: pytest-coverage.txt
junitxml-path: pytest.xml