Skip to content

Comments

More typing improvements#119

Open
stephenfin wants to merge 3 commits intotesting-cabal:masterfrom
stephenfin:typing
Open

More typing improvements#119
stephenfin wants to merge 3 commits intotesting-cabal:masterfrom
stephenfin:typing

Conversation

@stephenfin
Copy link
Collaborator

@stephenfin stephenfin commented Feb 20, 2026

See individual commits for details/motivation.

  • typing: Return Self from enter
  • typing: Use ParamSpec
  • typing: Improve types for WarningsCapture

This change is Reviewable

Otherwise the return value is typed as the Fixture class instead
of the actual class.

Signed-off-by: Stephen Finucane <stephen@that.guru>
This ensures args and kwargs are actually valid the cleanup function(s)
in question.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Actually expose the kwargs expected.

Signed-off-by: Stephen Finucane <stephen@that.guru>
from fixtures import Fixture

if TYPE_CHECKING:
from typing_extensions import Self
Copy link
Member

Choose a reason for hiding this comment

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

Can we import from typing on modern python versions, so we don't get a mandatory dependency on typing_extensions there?

from fixtures._fixtures.monkeypatch import MonkeyPatch

if TYPE_CHECKING:
from typing_extensions import NotRequired
Copy link
Member

Choose a reason for hiding this comment

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

See above

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