Skip to content

test(pilot): isolate pilot route tests from local .env and remove unused imports - #6

Merged
Aditya-XR merged 1 commit into
anishmehta24:mainfrom
Aditya-XR:test/pilot-api-env-isolation
Nov 3, 2026
Merged

Aditya-XR merged 1 commit into
anishmehta24:mainfrom
Aditya-XR:test/pilot-api-env-isolation

Conversation

@Aditya-XR

Copy link
Copy Markdown
Collaborator

Fixes #5

Problem

  1. Running pytest tests/test_pilot_api.py on a fresh clone or in CI without GEMINI_API_KEY / GROQ_API_KEY configured (or when PILOT_ENABLED=false is set in .env) fails 8 tests with 503 Service Unavailable. create_pilot depends on get_llm_router and settings.pilot_enabled, even though the test suite stubs out spawn and never calls the router.
  2. ruff check flags unused Issue and Repo imports (F401) in app/api/routes/pilot.py.

Fix

  • Add an autouse fixture _pilot_route_env in tests/test_pilot_api.py that sets settings.pilot_enabled = True and populates api_app.state.llm_router = object().
  • Remove the unused Issue and Repo imports from app/api/routes/pilot.py.

Tests

  • ruff check passes cleanly (0 errors).
  • pytest tests/test_pilot_api.py: all 14 tests pass without any LLM API keys configured.

Copilot AI balanced review requested due to automatic review settings November 3, 2026 00:03
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

@Aditya-XR is attempting to deploy a commit to the Anish Mehta's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Aditya-XR
Aditya-XR merged commit 643c93b into anishmehta24:main Nov 3, 2026
1 check failed
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.

bug(tests): test_pilot_api fails with 503 without LLM API keys and ruff F401 in pilot.py

2 participants