potiuk opened a new pull request, #6: URL: https://github.com/apache/airflow-steward/pull/6
## Summary Two related changes: 1. **More tests for `oauth-draft`** — pushes Python coverage from 62% → 99% (22 → 58 unit tests). 2. **A dedicated `tests.yml` CI workflow** — runs the per-tool pytest suites as a parallel matrix job, so test results show up as separate CI checks rather than buried inside the `prek` workflow's bundled `pytest` lines. Tests have been re-run locally; all 158 tests across both projects pass. ## Test additions (oauth-draft) | File | Added | Covers | |---|---|---| | `tests/test_credentials.py` | 3 tests | `refresh_access_token` — success path, HTTP error, missing `access_token` in payload | | `tests/test_create_draft.py` | 13 tests | `read_body`, `api_get`/`api_post` shapes + error path, `latest_reply_headers` delegation, `create_draft` payload (with/without `threadId`), `main` end-to-end (mocked network), `main --no-reply-headers` path | | `tests/test_mark_threads_read.py` | 9 tests | `list_thread_ids` pagination + HTTP error, `modify_thread` payloads + error, `main` dry-run / `--execute` / `--max` / failure-rc-1 paths | | `tests/test_setup_creds.py` | 11 tests | **(new file)** `detect_from_address` (env / git / errors / empty), `parse_args`, `main` error paths, `main` writes credentials atomically with mode 600 in mode-700 parent, `--rm-client-secrets`, `installed` vs `web` client_secrets shape | All network-touching code paths use `unittest.mock.patch` against `urllib.request.urlopen`; no test hits the real Gmail API. Coverage report on `src/oauth_draft/` after: ``` __init__.py 100% create_draft.py 99% credentials.py 100% mark_threads_read.py 99% setup_creds.py 89% TOTAL 99% ``` The remaining ~1% is the `if __name__ == "__main__":` shim in each module and a handful of chmod-warning branches in `setup_creds` that are awkward to provoke deterministically. ## CI workflow (`.github/workflows/tests.yml`) - Triggers on PR + push to `main`. - Per-project pytest matrix with `fail-fast: false` — both projects' pass/fail visible independently. - Uses `uv run --directory <project> --group dev pytest` (not `--project`) — pytest's `testpaths = ["tests"]` is cwd-relative, so we need to actually `cd` in. - The existing `prek` workflow's `pytest` hooks still run (defense in depth); this workflow is the visible signal. ## What's not in this PR `generate-cve-json` coverage stays at 79% — the gap is 207 lines of `cve_json.py`, mostly error/edge branches in the 1700-line module. Pushing it higher would balloon the PR substantially; happy to follow up in a separate one if you want it pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
