Skip to content

Add a pytest job and cover the PR reporter fallback - #77

Draft
aiolibsbot wants to merge 1 commit into
sanitizers:masterfrom
aiolibsbot:koan/test-foundation
Draft

aiolibsbot wants to merge 1 commit into
sanitizers:masterfrom
aiolibsbot:koan/test-foundation

Conversation

@aiolibsbot

@aiolibsbot aiolibsbot commented Sep 16, 2026 •

Copy link
Copy Markdown

What

Adds pytest.ini, a tests CI workflow, and a suite covering
PullRequestReporter's Checks-API-vs-comment fallback.

Why

The repo has no test suite and no CI workflow, so nothing verifies the logic
that decides what a user actually sees while a backport runs. Several open
backport branches (#72, #73, #74, #75, #76) add tests — without this, those
tests run nowhere once merged.

How

Covered: create_check raising PermissionError keeps reporting via the PR
comment; update_progress updates that comment even with no Checks API;
finish_reporting locks the PR on both paths and forwards conclusion;
omitted text/summary render as '' rather than None.

Testing

python -m pytest — 8 passed. Mutation-checked: moving the
_use_checks_api early return above the comment update makes the
fallback test fail, as intended.

Not addressed here: a pre-commit CI job — .pre-commit-config.yaml
already targets the hosted pre-commit.ci, so a duplicate workflow would
be noise.


Quality Report

Changes: 3 files changed, 224 insertions(+)

Code scan: clean

Tests: failed (command not found)

Branch hygiene: clean

Generated by Kōan

The repo had no test suite and no CI workflow, so nothing verified the
Checks-API-vs-comment fallback that decides what a user actually sees
while a backport runs.

Add `pytest.ini`, a `tests` workflow (pytest only, no third-party deps
needed -- `patchback.github_reporter` imports stdlib only) and a suite
for `PullRequestReporter`:

- `start_reporting` swallows a `PermissionError` from `create_check` and
  keeps reporting through the PR comment;
- `update_progress` updates the PR comment even when the Checks API is
  unavailable -- the comment is the only channel in that case;
- `finish_reporting` locks the PR on both paths and forwards the
  conclusion;
- omitted `text`/`summary` render as empty strings, not `None`.

`pytest.ini` and the workflow are byte-identical to the ones carried by
the open backport-reporting branches, so they merge in any order.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant