Skip to content

[pull] master from testing-cabal:master - #81

Merged
pull[bot] merged 10 commits into
sysfce2:masterfrom
testing-cabal:master
Mar 26, 2026
Merged

pull[bot] merged 10 commits into
sysfce2:masterfrom
testing-cabal:master

Conversation

@pull

@pull pull Bot commented Mar 26, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

stephenfin and others added 10 commits March 25, 2026 12:19
This matches what the docstring says and is okay at runtime given we
immediately wrap the passed attributes in a frozenset.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Add a new OptExcInfo, modelling what's in typeshed [1], and use this in
places where we expect to have potentially empty exc_info responses.
This allows us to remove a number of `type: ignore` statements.

[1] https://github.com/python/typeshed/blob/b7ac9ee66/stdlib/_typeshed/__init__.pyi#L318

Signed-off-by: Stephen Finucane <stephen@that.guru>
The 3rd argument in a `sys.exc_info` tuple will never be `None` unless
all arguments are `None`. Despite this, many of our types indicated
otherwise. The root cause of this assumption appears to be the
`_details_to_exc_info` helper, which handles test results that only
understand the stdlib API (i.e. no `details` argument). We rework that
helper to "re-raise" the `_StringException` we are capturing, allowing
us to return a small stub traceback rather than `None`. This should have
near-zero effect on end-users, beyond allowing them to walk the
exception using e.g. `traceback.format_tb` if they so wished (not that
it would be all that useful, given the shallowness of the traceback).

Note that this means most of the modified functions here can now use the
`ExcInfo` type alias. However, this is left to a future change to avoid
overly-complicating this one.

Signed-off-by: Stephen Finucane <stephen@that.guru>
To hold commonly used type aliases. We add ExcInfo and OptExcInfo,
rolling out use of these to more parts of the codebase.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Stephen Finucane <stephen@that.guru>
When called via a context manager, it's possible to provide a custom
message to be checked against the string of the raised exception. Update
the types to reflect this.

Signed-off-by: Stephen Finucane <stephen@that.guru>
The value_re parameter in both MatchesException and ExpectedException
was typed as `str | Matcher[BaseException] | None`, but this was too
narrow. The use of a Matcher here involves a preprocessor like str(),
which accepts any object. This causes AfterPreprocessing(str, ...) to be
inferred as Matcher[object] rather than Matcher[BaseException].

Widen the type to reflect what is actually accepted at runtime.

Signed-off-by: Stephen Finucane <stephen@that.guru>
mypy cannot infer the type of an empty dict. We need to explicitly type it.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Stephen Finucane <stephen@that.guru>
Another round of typing fixes
@pull pull Bot locked and limited conversation to collaborators Mar 26, 2026
@pull pull Bot added the ⤵️ pull label Mar 26, 2026
@pull
pull Bot merged commit 121c3a1 into sysfce2:master Mar 26, 2026

This branch was successfully deployed

No deployments
release — 121c3a1b Deployed Mar 26, 2026 by pull[bot] via build #33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants