Skip to content

fix: test failures, lint errors, and formatting#7

Merged
primetheus merged 2 commits intomainfrom
fix/test-and-lint-cleanup
Mar 20, 2026
Merged

fix: test failures, lint errors, and formatting#7
primetheus merged 2 commits intomainfrom
fix/test-and-lint-cleanup

Conversation

@primetheus
Copy link
Copy Markdown
Owner

Summary

Fixes all test failures, ruff lint errors, and black formatting issues.

Changes

Test fixes (7 failures → 0):

  • Webhook handler tests were POSTing to / instead of /webhooks/github/ (the default route)
  • Removed redundant init_app() calls — the constructor already calls init_app when app is passed

Lint fixes (ruff):

  • Removed unused imports: json, APIRouter, Request, mock_open
  • Removed unused local variables: result, client, github_app in tests that only assert side effects
  • Fixed type comparison: type(a) == type(b)isinstance(a, type(b)) (E721)

Formatting (black):

  • Reformatted core.py to comply with black defaults

Test plan

  • 59/59 tests pass
  • ruff check src/ tests/ — all checks passed
  • black --check src/ tests/ — all files unchanged

- 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
Copilot AI review requested due to automatic review settings March 20, 2026 17:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 redundant init_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
@primetheus primetheus merged commit 2ee0a9e into main Mar 20, 2026
7 checks passed
@primetheus primetheus deleted the fix/test-and-lint-cleanup branch March 20, 2026 17:23
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.

2 participants