fix: test failures, lint errors, and formatting#7
Merged
primetheus merged 2 commits intomainfrom Mar 20, 2026
Merged
Conversation
- Fix webhook handler tests posting to / instead of /webhooks/github/ - Remove redundant init_app() calls (constructor already calls it) - Remove unused imports (json, APIRouter, Request, mock_open) - Remove unused local variables (result, client, github_app) - Fix type comparison using isinstance() instead of type() == - Run black formatter on core.py - Run ruff autofix for import sorting
There was a problem hiding this comment.
Pull request overview
This PR cleans up the test suite and code style to eliminate failing tests and satisfy lint/formatting requirements, primarily by aligning webhook tests with the library’s default webhook route and removing unused variables/imports.
Changes:
- Updated webhook handler tests to POST to
/webhooks/github/(the default route) and removed redundantinit_app()calls in many cases. - Removed unused imports/locals in tests to satisfy ruff.
- Applied minor formatting cleanup in
src/githubapp/core.py.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
tests/test_rate_limiting.py |
Removes unused mock import and updates a type-related assertion for ruff compliance. |
tests/test_oauth.py |
Removes an unused json import. |
tests/test_core.py |
Fixes webhook test routes, removes unused imports/locals, and reduces redundant initialization. |
src/githubapp/core.py |
Minor formatting cleanup (whitespace). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…or type comparison - Remove empty signature verification tests (no assertions, always pass) - Remove empty extract_payload test (no assertions, always pass) - Use client1.__class__ is client2.__class__ for exact type comparison
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all test failures, ruff lint errors, and black formatting issues.
Changes
Test fixes (7 failures → 0):
/instead of/webhooks/github/(the default route)init_app()calls — the constructor already callsinit_appwhenappis passedLint fixes (ruff):
json,APIRouter,Request,mock_openresult,client,github_appin tests that only assert side effectstype(a) == type(b)→isinstance(a, type(b))(E721)Formatting (black):
core.pyto comply with black defaultsTest plan
ruff check src/ tests/— all checks passedblack --check src/ tests/— all files unchanged