Skip to content

Tests

Tests #972

Workflow file for this run

name: Tests
on:
push:
paths:
- "**.py"
- pyproject.toml
- uv.lock
- .github/workflows/uv-constraint.txt
- .github/workflows/tests.yml
branches:
- main
- "releases/**"
pull_request:
paths:
- "**.py"
- pyproject.toml
- uv.lock
- .github/workflows/uv-constraint.txt
- .github/workflows/tests.yml
branches:
- main
- "releases/**"
workflow_dispatch:
schedule:
- cron: "0 15 * * *" # Daily at 6pm Israel standard time
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.12", "3.13"]
runs-on: ${{ matrix.os }}
env:
FORCE_COLOR: 1
UV_PYTHON: ${{ matrix.python-version }}
UV_NO_SYNC: true
steps:
- uses: actions/checkout@v4
- name: Get uv version
id: uv-version
run: |
content=$(cat .github/workflows/uv-constraint.txt)
echo "version=${content#uv==}" >> $GITHUB_OUTPUT
- uses: astral-sh/setup-uv@v4
with:
version: ${{ steps.uv-version.outputs.version }}
enable-cache: true
cache-dependency-glob: uv.lock
cache-suffix: tests
- name: Install dependencies
# This step may also install the Python version set by the `UV_PYTHON` env var on the fly if not available
run: uv sync --no-group lint --no-group type-check
- name: Run live tests (needing an internet connection)
run: uv run coverage run -m pytest -m live
- name: Run offline tests
if: github.event_name != 'schedule'
run: uv run coverage run -am pytest -m "not live" --disable-network
- name: Report coverage
if: github.event_name != 'schedule'
run: uv run coverage report
# The following step will be removed when all the project is covered with tests
- name: Maintain 100% coverage on tested modules
if: github.event_name != 'schedule'
run: |
uv run coverage report --fail-under 100 \
xil/_currencies.py \
xil/_headers.py \
xil/_df_normalizer.py \
xil/onezero.py \
xil/discount.py \
xil/mercantile.py \
xil/leumi.py \
# xil/poalim.py \