Repository navigation
Description
Problem Description
The error-path tests and the log test in tests/test_github_app_identity.py do not follow docs/TESTING.md, section "Names and assertions". The rules are:
- An assertion compares whole values.
- A test of an error path checks the
DevOpsCLIErrorsubclass raised, with its exit code and machine-readable error code. - Tuple equality is only for picking fields out of an object whose other fields are noise.
Pull request #2482 added two tests that break these rules:
test_an_installation_without_a_requested_permission_fails_naming_the_permissionschecks only the classGitHubUnauthenticatedError, and a tuple of three substring booleans on the message. It does not check the exit code or the error code, and it does not compare the whole message.test_a_reply_that_grants_more_keeps_the_token_and_logs_only_the_permission_nameschecks the log records with the same boolean-tuple pattern, not the whole log message.
The older error-path tests of the same file use the same pattern: test_a_refused_exchange_raises_the_unauthenticated_error_with_githubs_status, test_a_key_that_is_no_rsa_key_fails_before_any_request and test_the_key_without_the_apps_settings_fails_naming_them.
Reproduction Steps
- Read docs/TESTING.md, lines 90-96.
- Read
tests/test_github_app_identity.pyat commit 9599ef2, lines 133-174 and 232-272. - The asserts are
pytest.raises(<error>)plus tuples of"<text>" in raised.value.messagebooleans. No test readsexit_codeorerror_code.
Expected vs Actual Behavior
Expected: each error-path test in the file compares the whole message, the exit code and the error code of the raised error, and the log test compares the whole log message.
Actual: the tests check substrings of the message only, so a change to the exit code, the error code or the rest of the message does not fail them.
Environment Diagnostics
Test code only. No devops command, option or message changes.
Logs, Traces, or Terminal Output
The whole message of the HTTP 422 path at 9599ef2: GitHub App devops-roadmap[bot] has no installation token: GitHub refused POST /app/installations/42/access_tokens (HTTP 422): The permissions requested are not granted to this installation. The installation must grant each permission that the token asks for: actions (read), checks (read), contents (write), issues (write), metadata (read), pull_requests (write). ...
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #2482
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The change updates test assertions to follow the rules in docs/TESTING.md.This is a test-quality fix with no user-facing impact and no failing build.It closes a gap where changes to exit codes or error codes would not be caught by the tests.A few assertion updates in one test file.Both require error-path tests to check exit code and error code, but #2177 covers all 85 files while the candidate covers only test_github_app_identity.py.test(github): the error-path tests of the GitHub App identity check t…