Skip to content

Add type annotations for instance attributes in testing#3451

Open
jorenham wants to merge 3 commits into
pallets:stablefrom
jorenham:typing/testing/coverage
Open

Add type annotations for instance attributes in testing#3451
jorenham wants to merge 3 commits into
pallets:stablefrom
jorenham:typing/testing/coverage

Conversation

@jorenham
Copy link
Copy Markdown
Contributor

@jorenham jorenham commented May 18, 2026

This is basically the story as #3422, and increases type coverage by 1.18& (91.5% -> 92.68%).

I also took the libery of narrowing the contextmanager return types from Iterator to Generator, because (based)pyright was complaining that using @contextmanager with -> Iterator is deprecated:

image

Copy link
Copy Markdown
Collaborator

@AndreasBackx AndreasBackx left a comment

Choose a reason for hiding this comment

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

Ctrl+c, ctrl+v: Just remove the version change and like other PR rebase on main instead perhaps?

Comment thread src/click/testing.py

CaptureMode = t.Literal["sys", "fd"]
CaptureMode: t.TypeAlias = t.Literal["sys", "fd"]
_ExceptionInfo: t.TypeAlias = tuple[type[BaseException], BaseException, TracebackType]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Like other PR, I think no _ prefix is the standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants