Skip to content

Adjust testclient typing and warnings#3322

Merged
Kludex merged 5 commits into
Kludex:mainfrom
waketzheng:codex/testclient-typing-warnings-20260607
Jun 10, 2026
Merged

Adjust testclient typing and warnings#3322
Kludex merged 5 commits into
Kludex:mainfrom
waketzheng:codex/testclient-typing-warnings-20260607

Conversation

@waketzheng

Copy link
Copy Markdown
Contributor

Summary

  • Move the Self import behind TYPE_CHECKING in testclient
  • Add clearer warning attribution for TestClient timeout deprecation warnings
  • Suppress the underlying ModuleNotFoundError chain when httpx2/httpx is missing
  • Keep WebSocketTestSession.__enter__ typed as Self

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 1 file

Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more

Re-trigger cubic

@Kludex Kludex closed this Jun 10, 2026
@Kludex Kludex reopened this Jun 10, 2026
Comment thread starlette/testclient.py
"You should not use the 'timeout' argument with the TestClient. "
"See https://github.com/Kludex/starlette/issues/1108 for more information.",
DeprecationWarning,
stacklevel=2,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This makes sense.

Comment thread starlette/testclient.py
"You can install this with:\n"
" $ pip install httpx2\n"
)
) from None

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This makes sense.

@Kludex Kludex left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The rest that I didn't mark as "This makes sense" I don't think makes sense.

@waketzheng

Copy link
Copy Markdown
Contributor Author

@Kludex Updated.

@Kludex Kludex merged commit 4a18cd4 into Kludex:main Jun 10, 2026
10 checks passed
@Kludex

Kludex commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Thanks!

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