test: use pytest.raises for the absent-attribute case (B018) #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: ci | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: py${{ matrix.python }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
| include: | |
| # Spot-check the other platforms on one version rather than a full | |
| # matrix — this is a pure-Python HTTP client, so OS risk is low. | |
| - os: macos-latest | |
| python: '3.12' | |
| - os: windows-latest | |
| python: '3.12' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - run: pip install -e ".[dev]" | |
| - name: Unit tests | |
| # Contract tests need a live key and are excluded here; they run in | |
| # the scheduled contract job instead. | |
| run: pytest -q -m "not contract" | |
| lint: | |
| name: lint + types | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - run: pip install -e ".[dev]" | |
| - run: ruff check src/ tests/ | |
| - run: ruff format --check src/ | |
| - run: mypy src/livetennisapi || true # advisory until fully annotated | |
| build: | |
| name: build + verify artifacts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - run: pip install build twine | |
| - run: python -m build | |
| - run: twine check dist/* | |
| - name: Install the built wheel in a clean environment | |
| run: | | |
| python -m venv /tmp/clean | |
| /tmp/clean/bin/pip install --quiet dist/*.whl | |
| /tmp/clean/bin/python -c "import livetennisapi; print(livetennisapi.__version__)" | |
| /tmp/clean/bin/livetennis --version | |
| /tmp/clean/bin/livetennis health | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |