Skip to content

Fix CI test count check to correctly parse pytest collection output #2

Fix CI test count check to correctly parse pytest collection output

Fix CI test count check to correctly parse pytest collection output #2

Workflow file for this run

name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Run tests
run: uv run pytest tests/ -v --cov --cov-report=term-missing
- name: Check test count
run: |
TEST_COUNT=$(uv run pytest tests/ --collect-only -q | grep "<Function test_" | wc -l | tr -d ' ')
echo "Found $TEST_COUNT tests"
if [ "$TEST_COUNT" -ne 7 ]; then
echo "Expected 7 tests, found $TEST_COUNT"
exit 1
fi