Skip to content

Improves test coverage for locksmith/core/machine.py #18

Improves test coverage for locksmith/core/machine.py

Improves test coverage for locksmith/core/machine.py #18

Workflow file for this run

# eustasy/.Normal 4.0beta9
name: Test (Python)
on:
workflow_dispatch:
push:
branches: [main]
paths: ["**.py"]
pull_request:
branches: [main]
paths: ["**.py"]
permissions:
contents: read
jobs:
test-python:
name: pytest + coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run pytest with coverage
# coverage.py's default C tracer under-counts `async def` bodies, so async
# routes (e.g. the /activate pipeline) look far less covered than they are.
# The sys.monitoring backend (PEP 669, Python 3.12+) measures them
# correctly; 3.11 lacks sys.monitoring, so it keeps the default tracer.
env:
COVERAGE_CORE: ${{ startsWith(matrix.python-version, '3.11') && 'ctrace' || 'sysmon' }}
run: pytest --cov --cov-report=xml:coverage/cobertura.xml
- name: Upload coverage to Qlty
if: matrix.python-version == '3.13'
uses: qltysh/qlty-action/coverage@a19242102d17e497f437d7466aa01b528537e899 # v2.2.0
with:
coverage-token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: coverage/cobertura.xml
# Coverage is measured with source=["locksmith"], so cobertura paths are
# relative to the package (api/app.py). Prepend the package dir so they
# resolve against the repo root (locksmith/api/app.py).
add-prefix: locksmith