Fix CI test count check to correctly parse pytest collection output #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |