Skip to content

Split large test files to comply with loq line limit#3328

Merged
jlowin merged 3 commits intomainfrom
claude/split-large-test-files-zC3Nl
Feb 28, 2026
Merged

Split large test files to comply with loq line limit#3328
jlowin merged 3 commits intomainfrom
claude/split-large-test-files-zC3Nl

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Feb 28, 2026

Several test files had grown beyond the 1000-line threshold enforced by loq, causing CI failures. This splits 13 oversized files into 27 smaller focused files, each under the limit, with no tests removed or modified.

Each original file retains its existing tests; extracted tests move to a companion file named for their subject (e.g. test_sampling.pytest_sampling_tool_loop.py + test_sampling_result_types.py). loq.toml is cleaned up to remove stale exceptions for files that no longer exist.

🤖 Generated with Claude Code

https://claude.ai/code/session_0174t6BGpdDCiwqULpizGU2E

All 13 test files that exceeded 1000 lines have been split into smaller
files, preserving all tests. loq.toml cleaned up to remove stale
exceptions for files that no longer exist.

https://claude.ai/code/session_0174t6BGpdDCiwqULpizGU2E
@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. tests labels Feb 28, 2026
@marvin-context-protocol
Copy link
Copy Markdown
Contributor

Test Failure Analysis

Summary: The static_analysis job failed because the new split test files contain unused imports and formatting issues that weren't cleaned up before committing.

Root Cause: Running prek run --all-files (ruff check + ruff format) found 20 lint errors and 10 files needing reformatting — all in the newly created test files. The unused imports were likely copied over from the original files but aren't needed in the smaller extracted versions.

Suggested Solution: Run prek run --all-files locally (or just uv run ruff check --fix . && uv run ruff format .) and commit the auto-fixed changes. The hooks will auto-fix everything; just stage and commit the results.

Detailed Analysis

ruff check (FAILED)

Found 20 errors (20 fixed, 0 remaining).

Ruff auto-fixed 20 lint errors, but since it modified files in CI, the hook still fails.

ruff format (FAILED)

10 files reformatted, 650 files left unchanged

Files with issues

File Issue
tests/client/test_elicitation.py Unused imports: Field, get_elicitation_schema
tests/client/test_elicitation_enums.py Missing blank line between import groups
tests/client/test_sampling_tool_loop.py Unused import pytest
tests/resources/test_resource_template.py Trailing blank lines
tests/resources/test_resource_template_query_params.py Unused imports: functools, quote, BaseModel, Context, FastMCP, FunctionResource, match_uri_template
tests/server/auth/providers/test_azure.py Trailing blank line
tests/server/auth/test_cimd.py Trailing blank lines
tests/server/auth/test_jwt_provider.py Unused imports: httpx, Client, BearerAuth
tests/server/auth/test_oauth_consent_flow.py Trailing blank lines
tests/server/auth/test_oidc_proxy.py Unused import UpstreamTokenSet; trailing blank lines
tests/server/middleware/test_middleware.py Unused import ToolError
tests/server/test_dependencies.py Trailing blank lines
tests/server/test_dependencies_advanced.py Unused import from fastmcp.dependencies import Depends
tests/utilities/openapi/test_transitive_references.py Unused imports: httpx, FastMCP, _replace_ref_with_defs
Related Files
  • .github/workflows/ — the static_analysis job runs prek run --all-files
  • All 14 test files listed above in the split/new test files introduced by this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c0eb65d26

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


from fastmcp import FastMCP
from fastmcp.client import Client
from fastmcp.dependencies import CurrentContext, Depends
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove stale imports left by the split tests

This new module keeps Depends at top level even though no test in the file uses that binding anymore, and several tests re-import Depends locally; under the repo's Ruff config this produces F401/F811 and causes the required static check step to fail (ruff check passes on the parent commit but fails after this change). Because CI expects lint to be clean before merge, this blocks the workflow until these stale imports are removed (the same pattern appears in other newly split test files as well).

Useful? React with 👍 / 👎.

@jlowin jlowin merged commit 610551c into main Feb 28, 2026
7 checks passed
@jlowin jlowin deleted the claude/split-large-test-files-zC3Nl branch February 28, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality. For issues and smaller PR improvements. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants